Set up siblings dirs for each build in the loop
The buildx patch unfortunately changed the logic associated with siblings to set up siblings in a loop one time, rather than to do a loop of "set up siblings, build, cleanup siblings". This causes builds to fail when they're using siblings with an error about siblings dir not having been cleaned up. Change-Id: I3c45bfa77ec9f2609689e04044c18f066adc9741
This commit is contained in:
parent
6f19965a6a
commit
f449ae20fb
@ -50,5 +50,5 @@
|
||||
|
||||
- name: Cleanup sibling source directory
|
||||
file:
|
||||
path: '{{ zuul_work_dir }}/.zuul-siblings'
|
||||
path: '{{ zuul_work_dir }}/{{ zj_image.context }}/.zuul-siblings'
|
||||
state: absent
|
||||
|
@ -1,3 +1,6 @@
|
||||
- name: Set up siblings
|
||||
include_tasks: siblings.yaml
|
||||
|
||||
- name: Build a docker image
|
||||
command: >-
|
||||
docker build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }}
|
||||
@ -23,3 +26,6 @@
|
||||
--label "org.zuul-ci.change_url={{ zuul.change_url }}"
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}/{{ zj_image.context }}"
|
||||
|
||||
- name: Cleanup sibling source directory
|
||||
include_tasks: clean-siblings.yaml
|
||||
|
@ -1,3 +1,6 @@
|
||||
- name: Set up siblings
|
||||
include_tasks: siblings.yaml
|
||||
|
||||
- name: Build a docker image
|
||||
command: >-
|
||||
docker buildx build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }}
|
||||
@ -34,3 +37,6 @@
|
||||
loop: "{{ zj_image.tags | default(['latest']) }}"
|
||||
loop_control:
|
||||
loop_var: zj_image_tag
|
||||
|
||||
- name: Cleanup sibling source directory
|
||||
include_tasks: clean-siblings.yaml
|
||||
|
4
roles/build-docker-image/tasks/clean-siblings.yaml
Normal file
4
roles/build-docker-image/tasks/clean-siblings.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
- name: Cleanup sibling source directory
|
||||
file:
|
||||
path: '{{ zuul_work_dir }}/{{ zj_image.context }}/.zuul-siblings'
|
||||
state: absent
|
@ -14,12 +14,6 @@
|
||||
- result_json_stat.stat.size > 0
|
||||
- "'buildset_registry' in (lookup('file', zuul.executor.work_root + '/results.json') | from_json)"
|
||||
|
||||
- name: Set up siblings
|
||||
include_tasks: siblings.yaml
|
||||
loop: "{{ docker_images }}"
|
||||
loop_control:
|
||||
loop_var: zj_image
|
||||
|
||||
# Docker doesn'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 docker not understanding ipv6 addresses
|
||||
|
@ -1,7 +1,10 @@
|
||||
FROM docker.io/upstream/image
|
||||
FROM docker.io/upstream/image as first
|
||||
ARG ZUUL_SIBLINGS=""
|
||||
RUN echo "Zuul siblings: ${ZUUL_SIBLINGS}"
|
||||
RUN cp /test-nonce /test-nonce-is-there
|
||||
COPY .zuul-siblings/opendev.org/project/fake-sibling/file /target
|
||||
COPY .zuul-siblings/openstack.org/project/fake-sibling/file /target
|
||||
CMD echo "Zuul container test"; sleep infinity
|
||||
|
||||
FROM first as second
|
||||
RUN echo "This is just to test that loops with siblings work"
|
||||
|
@ -140,9 +140,24 @@
|
||||
siblings:
|
||||
- opendev.org/project/fake-sibling
|
||||
- openstack.org/project/fake-sibling
|
||||
target: first
|
||||
- context: test-playbooks/registry/docker-siblings
|
||||
repository: downstream/image2
|
||||
target: second
|
||||
siblings:
|
||||
- opendev.org/project/fake-sibling
|
||||
- openstack.org/project/fake-sibling
|
||||
_arch_docker_images:
|
||||
- context: test-playbooks/registry/docker-siblings
|
||||
repository: downstream/image
|
||||
target: first
|
||||
siblings:
|
||||
- opendev.org/project/fake-sibling
|
||||
- openstack.org/project/fake-sibling
|
||||
arch: ['linux/amd64', 'linux/arm64']
|
||||
- context: test-playbooks/registry/docker-siblings
|
||||
repository: downstream/image2
|
||||
target: second
|
||||
siblings:
|
||||
- opendev.org/project/fake-sibling
|
||||
- openstack.org/project/fake-sibling
|
||||
|
Loading…
Reference in New Issue
Block a user