29d55cbf17
Add support for "siblings:" to the build-container-image role. This is a port of change I079d823e7194e15b1b496aea0f53f70f6b563f02 from the build-docker-image role. Note that we found a couple of issues with this role, fixed with I9f3b0a1f71d20cf7511f224648dd2fa51a039015. However, build-container-image has merged before this fix, so thess fixes now follow this change. To avoid squashing this into something confusing this update incorporates those fixes. However testing is left to the follow-on change because the extant build-docker-image role would fail the corrected testing. They should be merged roughly together. One minor thing is the removal of an additional duplicated "tags:" entry from the variable documentation. Change-Id: I71e2f2ab29446bd113644ce8c75378b8d3ef8ba6
43 lines
1.7 KiB
YAML
43 lines
1.7 KiB
YAML
# This can be removed if we add this functionality to Zuul directly
|
|
- name: Load information from zuul_return
|
|
when: buildset_registry is not defined
|
|
set_fact:
|
|
buildset_registry: "{{ (lookup('file', zuul.executor.work_root + '/results.json') | from_json)['buildset_registry'] }}"
|
|
ignore_errors: true
|
|
|
|
- name: Set container filename arg
|
|
set_fact:
|
|
containerfile: "{{ item.container_filename|default(container_filename|default('')) }}"
|
|
|
|
- name: Build container images
|
|
include_tasks: build.yaml
|
|
loop: "{{ container_images }}"
|
|
|
|
# Docker, and therefore skopeo and podman, don't understand docker
|
|
# push [1234:5678::]:5000/image/path:tag so we set up /etc/hosts with
|
|
# a registry alias name to support ipv6 and 4.
|
|
- name: Configure /etc/hosts for buildset_registry to workaround not understanding ipv6 addresses
|
|
become: yes
|
|
lineinfile:
|
|
path: /etc/hosts
|
|
state: present
|
|
regex: "^{{ buildset_registry.host }}\tzuul-jobs.buildset-registry$"
|
|
line: "{{ buildset_registry.host }}\tzuul-jobs.buildset-registry"
|
|
insertafter: EOF
|
|
when: buildset_registry is defined and buildset_registry.host | ipaddr
|
|
- name: Set buildset_registry alias variable when using ip
|
|
set_fact:
|
|
buildset_registry_alias: zuul-jobs.buildset-registry
|
|
when: buildset_registry is defined and buildset_registry.host | ipaddr
|
|
- name: Set buildset_registry alias variable when using name
|
|
set_fact:
|
|
buildset_registry_alias: "{{ buildset_registry.host }}"
|
|
when: buildset_registry is defined and not ( buildset_registry.host | ipaddr )
|
|
# Push each image.
|
|
- name: Push image to buildset registry
|
|
when: buildset_registry is defined
|
|
include_tasks: push.yaml
|
|
loop: "{{ container_images }}"
|
|
loop_control:
|
|
loop_var: image
|