Browse Source

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
master
James E. Blair 3 months ago
parent
commit
2a3d69c8be

+ 1
- 1
roles/pull-from-intermediate-registry/tasks/main.yaml View File

@@ -6,5 +6,5 @@
6 6
     {{ item.url }}
7 7
     docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ item.metadata.repository }}:{{ item.metadata.tag }}
8 8
   when: "item.metadata.type | default('') == 'container_image'"
9
-  loop: "{{ zuul.artifacts }}"
9
+  loop: "{{ zuul.artifacts | default([]) }}"
10 10
   # no_log: true  TODO(corvus): replace

+ 2
- 2
roles/push-to-intermediate-registry/tasks/push.yaml View File

@@ -5,7 +5,7 @@
5 5
     --dest-creds={{ intermediate_registry.username }}:{{ intermediate_registry.password }}
6 6
     docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ image.repository }}:{{ image_tag }}
7 7
     docker://{{ intermediate_registry.hostname }}:{{ intermediate_registry.port}}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag}}
8
-  loop: "{{ image.tags }}"
8
+  loop: "{{ image.tags | default(['latest']) }}"
9 9
   loop_control:
10 10
     loop_var: image_tag
11 11
   # no_log: true  TODO(corvus) replace
@@ -21,6 +21,6 @@
21 21
               type: container_image
22 22
               repository: "{{ image.repository }}"
23 23
               tag: "{{ image_tag }}"
24
-  loop: "{{ image.tags }}"
24
+  loop: "{{ image.tags | default(['latest']) }}"
25 25
   loop_control:
26 26
     loop_var: image_tag

Loading…
Cancel
Save