Merge "build-docker-image: fix up siblings copy"

This commit is contained in:
Zuul 2019-12-09 23:49:16 +00:00 committed by Gerrit Code Review
commit 641baedc4c
3 changed files with 18 additions and 11 deletions

View File

@ -1,6 +1,6 @@
- name: Check sibling directory
stat:
path: '{{ zuul_work_dir }}/.zuul-siblings'
path: '{{ zuul_work_dir }}/{{ item.context }}/.zuul-siblings'
register: _dot_zuul_siblings
# This should have been cleaned up; multiple builds may specify
@ -11,7 +11,7 @@
- name: Create sibling source directory
file:
path: '{{ zuul_work_dir }}/.zuul-siblings'
path: '{{ zuul_work_dir }}/{{ item.context }}/.zuul-siblings'
state: directory
mode: 0755
when: item.siblings is defined
@ -19,7 +19,9 @@
# NOTE(ianw): could use recursive copy: with remote_src, but it's
# Ansible 2.8 only. take the simple approach.
- name: Copy sibling source directories
command: 'cp -r ~/src/{{ sibling }} {{ zuul_work_dir }}/.zuul-siblings/'
command:
cmd: 'cp --parents -r {{ sibling }} /home/zuul/{{ zuul_work_dir }}/{{ item.context }}/.zuul-siblings'
chdir: '~/src'
loop: '{{ item.siblings }}'
loop_control:
loop_var: sibling

View File

@ -0,0 +1,6 @@
FROM docker.io/library/debian:testing
ARG ZUUL_SIBLINGS=""
RUN echo "Zuul siblings: ${ZUUL_SIBLINGS}"
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

View File

@ -125,23 +125,22 @@
- name: Create fake sibling projects
command: >-
mkdir -p src/opendev.org/fake-sibling-1 &&
mkdir -p src/opendev.org/fake-sibling-2 &&
touch src/opendev.org/fake-sibling-1/file &&
touch src/opendev.org/fake-sibling-2/file
mkdir -p src/opendev.org/project/fake-sibling &&
mkdir -p src/openstack.org/project/fake-sibling &&
touch src/opendev.org/project/fake-sibling/file &&
touch src/openstack.org/project/fake-sibling/file
- name: Build docker image
include_role:
name: "build-{{ (container_command == 'docker') | ternary('docker', 'container') }}-image"
vars:
docker_images:
- context: test-playbooks/registry/docker
- context: test-playbooks/registry/docker-siblings
repository: downstream/image
siblings:
- opendev.org/fake-sibling-1
- opendev.org/fake-sibling-2
- opendev.org/project/fake-sibling
- openstack.org/project/fake-sibling
container_images: "{{ docker_images }}"
- hosts: executor
name: Test pushing to the intermediate registry
tasks: