Fix image manifest creation in zuul CI

Sem-Ver: fix
Change-Id: Ie6041a7b38903ee2dc04333ad08a742102fb3e55
diff --git a/images/master.yml b/images/master.yml
index 1801720..a74429e 100644
--- a/images/master.yml
+++ b/images/master.yml
@@ -18,7 +18,7 @@
   tempest:
     branch: master
     revision: 44dac69eb77d78a0de8e68e63617099249345578
-    tag: 30.1.0-0
+    tag: 30.1.0-3
     pip_packages:
       - keystone-tempest-plugin
       - cinder-tempest-plugin
diff --git a/releasenotes/notes/zuul-fix-image-manifest-creation-d27b972f00fba609.yaml b/releasenotes/notes/zuul-fix-image-manifest-creation-d27b972f00fba609.yaml
new file mode 100644
index 0000000..9371f12
--- /dev/null
+++ b/releasenotes/notes/zuul-fix-image-manifest-creation-d27b972f00fba609.yaml
@@ -0,0 +1,3 @@
+---
+fixes:
+  - Fix image manifest creation in zuul CI
diff --git a/zuul.d/images.yaml b/zuul.d/images.yaml
index c487221..8dfe728 100644
--- a/zuul.d/images.yaml
+++ b/zuul.d/images.yaml
@@ -46,6 +46,10 @@
 - job:
     name: ansible-collection-atmosphere-upload-images-manifest
     parent: ansible-collection-atmosphere-build-images-manifest
+    secrets:
+      name: docker_credentials
+      secret: gar-credentials
+      pass-to-parent: true
 
 - project:
     check:
diff --git a/zuul.d/playbooks/ansible-collection-atmosphere-build-images-manifest/run.yml b/zuul.d/playbooks/ansible-collection-atmosphere-build-images-manifest/run.yml
index 2ded2c2..98eb70a 100644
--- a/zuul.d/playbooks/ansible-collection-atmosphere-build-images-manifest/run.yml
+++ b/zuul.d/playbooks/ansible-collection-atmosphere-build-images-manifest/run.yml
@@ -19,6 +19,11 @@
         file: "../../../images/{{ openstack_release }}.yml"
         name: image_manifest
 
+    - name: Login container registry
+      when: zuul.job is not search("build")
+      command:
+        podman login -u {{ docker_credentials.username }} -p {{ docker_credentials.password }} {{ image_manifest.registry }}
+
     - name: Create manifest for every project built
       command:
         podman manifest create {{ item | basename }}:{{ image_manifest['projects'][item.rsplit('/')[-1]]['tag'] }}
@@ -32,7 +37,7 @@
           {{ item.url }}
       loop: "{{ zuul.artifacts | selectattr('metadata.type', 'defined') | selectattr('metadata.type', 'equalto', 'image') | list }}"
 
-    - name: Push manifests to buildset registry
+    - name: Push manifests to container registry
       command:
         podman manifest push
           {{ item | basename }}:{{ image_manifest['projects'][item.rsplit('/')[-1]]['tag'] }}
diff --git a/zuul.d/playbooks/ansible-collection-atmosphere-build-images/run.yml b/zuul.d/playbooks/ansible-collection-atmosphere-build-images/run.yml
index 7f879cf..1c153c9 100644
--- a/zuul.d/playbooks/ansible-collection-atmosphere-build-images/run.yml
+++ b/zuul.d/playbooks/ansible-collection-atmosphere-build-images/run.yml
@@ -114,17 +114,50 @@
               - "{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
 
     - name: Return artifacts to Zuul
-      zuul_return:
-        data:
-          zuul:
-            artifacts:
-              - name: "{{ item }} ({{ ansible_architecture }})"
-                url: "docker://{{ _docker_registry }}/{{ item }}:{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
-                metadata:
-                  type: image
-                  repository: "docker://{{ _docker_registry }}/{{ item }}"
-                  project: "{{ item }}"
-                  arch: "{{ ansible_architecture }}"
-      vars:
-        _docker_registry: "{{ (docker_registry is defined) | ternary(docker_registry, 'zuul-jobs.buildset-registry:5000') }}"
-      loop: "{{ _build_docker_image.results | map(attribute='item') | list }}"
+      block:
+        - name: Return artifacts to Zuul for build
+          when: zuul.job is search("build")
+          zuul_return:
+            data:
+              zuul:
+                artifacts:
+                  - name: "{{ item }} ({{ ansible_architecture }})"
+                    url: "docker://{{ _docker_registry }}/{{ item }}:{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
+                    metadata:
+                      type: image
+                      repository: "docker://{{ _docker_registry }}/{{ item }}"
+                      project: "{{ item }}"
+                      arch: "{{ ansible_architecture }}"
+          vars:
+            _docker_registry: "zuul-jobs.buildset-registry:5000"
+          loop: "{{ _build_docker_image.results | map(attribute='item') | list }}"
+
+        - name: Return artifacts to Zuul for upload
+          when: zuul.job is search("upload")
+          zuul_return:
+            data:
+              zuul:
+                artifacts:
+                  - name: "{{ item }} ({{ ansible_architecture }})"
+                    url: "docker://{{ image_manifest.registry }}/{{ item }}:{{ ('change_' + zuul.change) if (zuul.change is defined) else zuul.pipeline }}_{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
+                    metadata:
+                      type: image
+                      repository: "docker://{{ image_manifest.registry }}/{{ item }}"
+                      project: "{{ item }}"
+                      arch: "{{ ansible_architecture }}"
+          loop: "{{ _build_docker_image.results | map(attribute='item') | list }}"
+
+        - name: Return artifacts to Zuul for promote
+          when: zuul.job is search("promote")
+          zuul_return:
+            data:
+              zuul:
+                artifacts:
+                  - name: "{{ item }} ({{ ansible_architecture }})"
+                    url: "docker://{{ image_manifest.registry }}/{{ item }}:{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
+                    metadata:
+                      type: image
+                      repository: "docker://{{ image_manifest.registry }}/{{ item }}"
+                      project: "{{ item }}"
+                      arch: "{{ ansible_architecture }}"
+          loop: "{{ _build_docker_image.results | map(attribute='item') | list }}"