From d1e74606bcdfdf9cbf1e6c3c56005cff88ccb4eb Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 24 Mar 2023 10:30:26 +1100 Subject: [PATCH] push-to-intermediate-registry: look for container_images variable When used with the container-image roles, the variable is container_images, not docker_images. Change-Id: I074f9523aea7d71879f722b88ff7c3e7e45fb90f --- roles/push-to-intermediate-registry/README.rst | 18 +++++++++++++++++- .../tasks/main.yaml | 2 +- .../tasks/push.yaml | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/roles/push-to-intermediate-registry/README.rst b/roles/push-to-intermediate-registry/README.rst index 93a2a6ee4..dfc249a7f 100644 --- a/roles/push-to-intermediate-registry/README.rst +++ b/roles/push-to-intermediate-registry/README.rst @@ -1,7 +1,8 @@ Push artifacts to the intermediate registry This role will push any images built by -:zuul:role:`build-docker-image` into an intermediate registry. +:zuul:role:`build-docker-image` or :zuul:role:`build-container-image` +into an intermediate registry. Run this in a trusted post-playbook at the end of a job after the image build. @@ -73,3 +74,18 @@ registry operating for the use of Zuul, and it requires "skopeo" and :default: ['latest'] A list of tags to be added to the image. + +.. zuul:rolevar:: container_images + :type: list + + A list of images built. Each item in the list should have: + + .. zuul:rolevar:: repository + + The name of the target repository for the image. + + .. zuul:rolevar:: tags + :type: list + :default: ['latest'] + + A list of tags to be added to the image. diff --git a/roles/push-to-intermediate-registry/tasks/main.yaml b/roles/push-to-intermediate-registry/tasks/main.yaml index 5bf1baabf..be108bcf2 100644 --- a/roles/push-to-intermediate-registry/tasks/main.yaml +++ b/roles/push-to-intermediate-registry/tasks/main.yaml @@ -1,5 +1,5 @@ - name: Push images to intermediate registry when: - - docker_images is defined + - (docker_images is defined) or (container_images is defined) - zuul_success | default(true) | bool include_tasks: push.yaml diff --git a/roles/push-to-intermediate-registry/tasks/push.yaml b/roles/push-to-intermediate-registry/tasks/push.yaml index a4e4a143d..edd48784e 100644 --- a/roles/push-to-intermediate-registry/tasks/push.yaml +++ b/roles/push-to-intermediate-registry/tasks/push.yaml @@ -88,7 +88,7 @@ block: - name: Push image to intermediate registry include_tasks: push-image.yaml - loop: "{{ docker_images }}" + loop: "{{ docker_images if docker_images is defined else container_images }}" loop_control: loop_var: zj_image always: