
Add a job that tests the build-container-image role as it would be used in a tag-based release pipeline (as opposed to check or gate+promote). Also, correct an issue in the role where we assumed zuul.change existed. Change-Id: If2566764a52726ce45fff9b5e96ce9a42d513d8d
34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
- 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) }}
|
|
{% if zj_image.target | default(false) -%}
|
|
--target {{ zj_image.target }}
|
|
{% endif -%}
|
|
{% for build_arg in zj_image.build_args | default([]) -%}
|
|
--build-arg {{ build_arg }}
|
|
{% endfor -%}
|
|
{% if zj_image.siblings | default(false) -%}
|
|
--build-arg "ZUUL_SIBLINGS={{ zj_image.siblings | join(' ') }}"
|
|
{% endif -%}
|
|
{% for tag in zj_image.tags | default(['latest']) -%}
|
|
{% if zuul.change | default(false) -%}
|
|
--tag {{ zj_image.repository }}:change_{{ zuul.change }}_{{ tag }}
|
|
{% endif -%}
|
|
--tag {{ zj_image.repository }}:{{ tag }}
|
|
{% endfor -%}
|
|
{% for label in zj_image.labels | default([]) -%}
|
|
--label "{{ label }}"
|
|
{% endfor %}
|
|
{% if zuul.change | default(false) -%}
|
|
--label "org.zuul-ci.change={{ zuul.change }}"
|
|
{% endif -%}
|
|
--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
|