aboutsummaryrefslogtreecommitdiff
path: root/tests/playbooks/publish.yml
blob: 7c217fa376e9184c0c0d19d0204d7b7fd1f09d9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
- name: Zuul publish
  hosts: all
  vars:
    # NOTE(yoctozepto): We need Docker SDK, the best source is Kolla venv.
    ansible_python_interpreter: "{{ virtualenv_path }}/bin/python"
  tasks:
    - name: List all containers
      community.docker.docker_host_info:
        images: true
        images_filters:
          reference: "{{ kolla_namespace }}/*"
      register: docker_host_info

    - name: Publish to quay.io
      when: kolla_registry == 'quay.io'
      block:
        - name: Login to quay.io
          community.docker.docker_login:
            registry: quay.io
            username: "{{ kolla_quay_io_creds.username | trim }}"
            password: "{{ kolla_quay_io_creds.password | trim }}"

        - name: Push built container images
          community.docker.docker_image:
            name: "{{ item.RepoTags.0 }}"
            push: true
            repository: "quay.io/{{ item.RepoTags.0 }}"
            source: local
          loop: "{{ docker_host_info.images }}"
          register: push_status
          until: push_status.failed is false
          retries: 5

        - name: Ensure repository visibility is public
          ansible.builtin.uri:
            url: "https://quay.io/api/v1/repository/{{ item.RepoTags.0 }}/changevisibility"
            method: POST
            headers:
              Authorization: "Bearer {{ kolla_quay_io_api.token | trim }}"
            body: '{"visibility": "public"}'
            body_format: json
          loop: "{{ docker_host_info.images }}"