428f371249
Periodic jobs are failing because Zuul Ansible executor runs with Ansible 8 which uses community.docker collection that needs requests<2.32. Revert this patch when Zuul supports Ansible 10, and/or Ansible 9 gets fixed community.docker collection. [1] [1] https://github.com/ansible-collections/community.docker/issues/868 Related-Bug: #2066364 Change-Id: I1dda73b0bc9a9f57ec8fda3f2234449b04906410
68 lines
2.4 KiB
YAML
68 lines
2.4 KiB
YAML
---
|
|
- hosts: all
|
|
vars:
|
|
# NOTE(yoctozepto): We need Docker SDK, the best source is Kolla venv.
|
|
ansible_python_interpreter: "{{ virtualenv_path }}/bin/python"
|
|
tasks:
|
|
# TODO(bbezak): Currently Zuul supports Ansible 8 or 9, which
|
|
# uses community.docker collection that needs requests<2.32.
|
|
# Remove this when Zuul supports Ansible 10,
|
|
# and/or Ansible 9 gets fixed community.docker collection.
|
|
# https://github.com/ansible-collections/community.docker/issues/868
|
|
- name: Downgrade requests for community.docker collection
|
|
command:
|
|
cmd: "{{ virtualenv_path }}/bin/python -m pip install -v 'requests<2.32'"
|
|
|
|
- name: List all containers
|
|
docker_host_info:
|
|
images: yes
|
|
images_filters:
|
|
reference: "{{ kolla_namespace }}/*"
|
|
register: docker_host_info
|
|
|
|
- block:
|
|
- name: Login to Dockerhub
|
|
docker_login:
|
|
username: "{{ kolla_dockerhub_credentials.username | trim }}"
|
|
password: "{{ kolla_dockerhub_credentials.password | trim }}"
|
|
|
|
- name: Push built container images
|
|
docker_image:
|
|
name: "{{ item.RepoTags.0 }}"
|
|
push: yes
|
|
source: local
|
|
loop: "{{ docker_host_info.images }}"
|
|
register: push_status
|
|
until: push_status.failed is false
|
|
retries: 5
|
|
when: kolla_registry == 'dockerhub'
|
|
|
|
- block:
|
|
- name: Login to quay.io
|
|
docker_login:
|
|
registry: quay.io
|
|
username: "{{ kolla_quay_io_creds.username | trim }}"
|
|
password: "{{ kolla_quay_io_creds.password | trim }}"
|
|
|
|
- name: Push built container images
|
|
docker_image:
|
|
name: "{{ item.RepoTags.0 }}"
|
|
push: yes
|
|
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
|
|
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 }}"
|
|
when: kolla_registry == 'quay.io'
|