blob: 0bd8ac81f4b4505edffb155de9f9a1cca6685e28 [file] [log] [blame]
- gather_facts: false
hosts: all
tasks:
- include_role:
name: start-zuul-console
name: "Start zuul_console"
when: "zuul is defined"
- become: true
name: "Install podman"
package:
name: podman
state: present
when: "false"
- include_role:
name: use-buildset-registry
name: "Setup intermediate registry"
vars:
buildset_registry: intermediate_registry_secret
when: "intermediate_registry_secret is defined"
- name: "Clean build directory"
shell:
cmd: "rm -Rf {{ image_name }}; mkdir -p {{ image_name }}"
- copy:
content: "{{ container_file }}"
dest: "{{ image_name }}/Containerfile-build"
name: "Create the build Containerfile"
- copy:
content: "{{ update_file }}"
dest: "{{ image_name }}/Containerfile-update"
name: "Create the update Containerfile"
- changed_when: "False"
command: "podman image exists {{ image_ref }}"
failed_when: "False"
name: "Check if image exists"
register: _image_exists
- command: "podman build -f Containerfile-{% if _image_exists.rc == 0 %}update{% else %}build{% endif %} -t {{ image_ref }} {{ image_name }}"
name: "Build new image"
- command: "podman push {{ image_ref }} server-zuul:9000/{{ image_ref }}"
name: "Push new image to intermediate registry"
vars:
image_ref: "{{ org_name }}/{{ image_name }}"