4617d0835a
The container roles assume a full image url path and do not work with shorted names like the docker roles do. The buildx path used the shorted path when it should use the full path. Fix this. Change-Id: Icdeee0ebb1c0d280968f425f8560cc5208ebd18d
74 lines
2.9 KiB
YAML
74 lines
2.9 KiB
YAML
- hosts: all
|
|
vars:
|
|
_multiarch_docker_images:
|
|
- context: test-playbooks/container/docker
|
|
repository: "testrepo"
|
|
# This is what the Zuul repo uses to tag its releases:
|
|
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
|
|
arch: ['linux/amd64', 'linux/arm64']
|
|
_normal_docker_images:
|
|
- context: test-playbooks/container/docker
|
|
repository: "testrepo"
|
|
# This is what the Zuul repo uses to tag its releases:
|
|
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
|
|
_multiarch_container_images:
|
|
- context: test-playbooks/container/docker
|
|
registry: localhost
|
|
repository: localhost/testrepo
|
|
# This is what the Zuul repo uses to tag its releases:
|
|
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
|
|
arch: ['linux/amd64', 'linux/arm64']
|
|
_normal_container_images:
|
|
- context: test-playbooks/container/docker
|
|
registry: localhost
|
|
repository: localhost/testrepo
|
|
# This is what the Zuul repo uses to tag its releases:
|
|
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
|
|
tasks:
|
|
- name: Set docker_images variable
|
|
when: "roleset == 'docker'"
|
|
set_fact:
|
|
docker_images: "{{ multiarch | ternary(_multiarch_docker_images, _normal_docker_images) }}"
|
|
|
|
- name: Set container_images variable
|
|
when: "roleset == 'container'"
|
|
set_fact:
|
|
container_images: "{{ multiarch | ternary(_multiarch_container_images, _normal_container_images) }}"
|
|
|
|
- name: Save zuul variables
|
|
set_fact:
|
|
old_zuul: "{{ zuul }}"
|
|
|
|
- name: Set simulated zuul variables
|
|
set_fact:
|
|
new_zuul:
|
|
pipeline: "{{ old_zuul.pipeline }}"
|
|
change_url: "{{ old_zuul.change_url }}"
|
|
executor: "{{ old_zuul.executor }}"
|
|
newrev: c12f3fe1defe8b61d59061363c9c04fb520dae18
|
|
project: "{{ old_zuul.project }}"
|
|
ref: refs/tags/3.19.0
|
|
tag: 3.19.0
|
|
|
|
- name: "Build a container image"
|
|
include_role:
|
|
name: "build-{{ roleset }}-image"
|
|
vars:
|
|
zuul: "{{ new_zuul }}"
|
|
|
|
- name: "Upload container image"
|
|
include_role:
|
|
name: "upload-{{ roleset }}-image"
|
|
vars:
|
|
zuul: "{{ new_zuul }}"
|
|
|
|
- name: "Upload container image"
|
|
when: "promote"
|
|
include_role:
|
|
name: "upload-{{ roleset }}-image"
|
|
vars:
|
|
zuul: "{{ new_zuul }}"
|
|
|
|
- name: "Show local container images for debugging"
|
|
command: "{{ container_command }} image ls"
|