From 2a3d69c8beda2599780dde5e96e1b1cb8f9a3872 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 14 Feb 2019 15:00:23 -0800 Subject: [PATCH] Fix undefined attrs in registry push/pull roles The attribute zuul.artifacts is only present if there are artifacts. Use the empty list as default. The default for image.tags should be 'latest' to match the rest of the docker roles. Change-Id: Iff6863043e3a0311cb1c8c2ef4cd3d37ff79cce5 --- roles/pull-from-intermediate-registry/tasks/main.yaml | 2 +- roles/push-to-intermediate-registry/tasks/push.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/pull-from-intermediate-registry/tasks/main.yaml b/roles/pull-from-intermediate-registry/tasks/main.yaml index 090443b69..b4fb5c463 100644 --- a/roles/pull-from-intermediate-registry/tasks/main.yaml +++ b/roles/pull-from-intermediate-registry/tasks/main.yaml @@ -6,5 +6,5 @@ {{ item.url }} docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ item.metadata.repository }}:{{ item.metadata.tag }} when: "item.metadata.type | default('') == 'container_image'" - loop: "{{ zuul.artifacts }}" + loop: "{{ zuul.artifacts | default([]) }}" # no_log: true TODO(corvus): replace diff --git a/roles/push-to-intermediate-registry/tasks/push.yaml b/roles/push-to-intermediate-registry/tasks/push.yaml index 8773a3637..0d21d4529 100644 --- a/roles/push-to-intermediate-registry/tasks/push.yaml +++ b/roles/push-to-intermediate-registry/tasks/push.yaml @@ -5,7 +5,7 @@ --dest-creds={{ intermediate_registry.username }}:{{ intermediate_registry.password }} docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ image.repository }}:{{ image_tag }} docker://{{ intermediate_registry.hostname }}:{{ intermediate_registry.port}}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag}} - loop: "{{ image.tags }}" + loop: "{{ image.tags | default(['latest']) }}" loop_control: loop_var: image_tag # no_log: true TODO(corvus) replace @@ -21,6 +21,6 @@ type: container_image repository: "{{ image.repository }}" tag: "{{ image_tag }}" - loop: "{{ image.tags }}" + loop: "{{ image.tags | default(['latest']) }}" loop_control: loop_var: image_tag