42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
# assert sibling dir not present
|
|
|
|
- name: Create sibling source directory
|
|
file:
|
|
path: '{{ zuul_work_dir }}/.zuul-siblings'
|
|
state: directory
|
|
mode: 0755
|
|
when: item.siblings is defined
|
|
|
|
# use recursive copy with remote_src? ansible 2.8 only
|
|
- name: Copy sibling source directories
|
|
command: 'cp -r ~/src/{{ sibling }} {{ zuul_work_dir}}/.zuul-siblings/'
|
|
loop: '{{ item.siblings }}'
|
|
loop_control:
|
|
loop_var: sibling
|
|
when: item.siblings is defined
|
|
|
|
- name: Build a docker image
|
|
command: >-
|
|
docker build {{ item.path | default('.') }} -f {{ item.dockerfile | default(docker_dockerfile) }}
|
|
{% if item.target | default(false) -%}
|
|
--target {{ item.target }}
|
|
{% endif -%}
|
|
{% for build_arg in item.build_args | default([]) -%}
|
|
--build-arg {{ build_arg }}
|
|
{% endfor -%}
|
|
{% if item.siblings | default(false) -%}
|
|
--build-arg "ZUUL_SIBLINGS={{ item.siblings | join(' ')}}"
|
|
{% endif -%}
|
|
{% for tag in item.tags | default(['latest']) -%}
|
|
--tag {{ item.repository }}:change_{{ zuul.change }}_{{ tag }}
|
|
--tag {{ item.repository }}:{{ tag }}
|
|
{% endfor -%}
|
|
args:
|
|
chdir: "{{ zuul_work_dir }}/{{ item.context }}"
|
|
|
|
- name: Cleanup sibling source directory
|
|
file:
|
|
path: '{{ zuul_work_dir }}/.zuul-siblings'
|
|
state: absent
|
|
|