Fix image manifest creation in zuul CI

Sem-Ver: fix
Change-Id: Ie6041a7b38903ee2dc04333ad08a742102fb3e55
This commit is contained in:
okozachenko 2022-04-22 15:28:54 +10:00 committed by Mohammed Naser
parent d4cf5d8687
commit 2369af9a49
5 changed files with 61 additions and 16 deletions

View File

@ -18,7 +18,7 @@ projects:
tempest: tempest:
branch: master branch: master
revision: 44dac69eb77d78a0de8e68e63617099249345578 revision: 44dac69eb77d78a0de8e68e63617099249345578
tag: 30.1.0-0 tag: 30.1.0-3
pip_packages: pip_packages:
- keystone-tempest-plugin - keystone-tempest-plugin
- cinder-tempest-plugin - cinder-tempest-plugin

View File

@ -0,0 +1,3 @@
---
fixes:
- Fix image manifest creation in zuul CI

View File

@ -46,6 +46,10 @@
- job: - job:
name: ansible-collection-atmosphere-upload-images-manifest name: ansible-collection-atmosphere-upload-images-manifest
parent: ansible-collection-atmosphere-build-images-manifest parent: ansible-collection-atmosphere-build-images-manifest
secrets:
name: docker_credentials
secret: gar-credentials
pass-to-parent: true
- project: - project:
check: check:

View File

@ -19,6 +19,11 @@
file: "../../../images/{{ openstack_release }}.yml" file: "../../../images/{{ openstack_release }}.yml"
name: image_manifest 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 - name: Create manifest for every project built
command: command:
podman manifest create {{ item | basename }}:{{ image_manifest['projects'][item.rsplit('/')[-1]]['tag'] }} podman manifest create {{ item | basename }}:{{ image_manifest['projects'][item.rsplit('/')[-1]]['tag'] }}
@ -32,7 +37,7 @@
{{ item.url }} {{ item.url }}
loop: "{{ zuul.artifacts | selectattr('metadata.type', 'defined') | selectattr('metadata.type', 'equalto', 'image') | list }}" 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: command:
podman manifest push podman manifest push
{{ item | basename }}:{{ image_manifest['projects'][item.rsplit('/')[-1]]['tag'] }} {{ item | basename }}:{{ image_manifest['projects'][item.rsplit('/')[-1]]['tag'] }}

View File

@ -114,17 +114,50 @@
- "{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}" - "{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
- name: Return artifacts to Zuul - name: Return artifacts to Zuul
zuul_return: block:
data: - name: Return artifacts to Zuul for build
zuul: when: zuul.job is search("build")
artifacts: zuul_return:
- name: "{{ item }} ({{ ansible_architecture }})" data:
url: "docker://{{ _docker_registry }}/{{ item }}:{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}" zuul:
metadata: artifacts:
type: image - name: "{{ item }} ({{ ansible_architecture }})"
repository: "docker://{{ _docker_registry }}/{{ item }}" url: "docker://{{ _docker_registry }}/{{ item }}:{{ image_manifest['projects'][item]['tag'] }}-{{ ansible_architecture }}"
project: "{{ item }}" metadata:
arch: "{{ ansible_architecture }}" type: image
vars: repository: "docker://{{ _docker_registry }}/{{ item }}"
_docker_registry: "{{ (docker_registry is defined) | ternary(docker_registry, 'zuul-jobs.buildset-registry:5000') }}" project: "{{ item }}"
loop: "{{ _build_docker_image.results | map(attribute='item') | list }}" 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 }}"