67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
- hosts: all
|
|
tasks:
|
|
- name: Install Docker (Debian)
|
|
block:
|
|
- apt:
|
|
name: "{{ item }}"
|
|
with_items:
|
|
- docker.io
|
|
- python-pip
|
|
when: ansible_os_family == 'Debian'
|
|
- pip:
|
|
name: docker
|
|
version: 2.7.0
|
|
become: True
|
|
|
|
- name: Debug tag generation inputs
|
|
block:
|
|
- debug:
|
|
var: publish
|
|
- debug:
|
|
var: tags
|
|
- debug:
|
|
var: zuul
|
|
- debug:
|
|
msg: "{{ tags | to_json }}"
|
|
|
|
- name: Determine tags
|
|
shell: echo '{{ tags | to_json }}' | python {{ zuul.project.src_dir }}/tools/image_tags.py
|
|
environment:
|
|
BRANCH: "{{ zuul.branch }}"
|
|
CHANGE: "{{ zuul.change }}"
|
|
COMMIT: "{{ zuul.newrev }}"
|
|
PATCHSET: "{{ zuul.patchset }}"
|
|
register: image_tags
|
|
|
|
- name: Debug computed tags
|
|
debug:
|
|
var: image_tags
|
|
|
|
- name: Docker login
|
|
docker_login:
|
|
password: "{{ airship_promenade_quay_creds.password }}"
|
|
username: "{{ airship_promenade_quay_creds.username }}"
|
|
registry_url: "https://quay.io/api/v1/"
|
|
|
|
become: True
|
|
when: publish
|
|
|
|
- name: Build (and push) images
|
|
block:
|
|
- docker_image:
|
|
name: "quay.io/airshipit/promenade"
|
|
dockerfile: "Dockerfile"
|
|
path: "{{ zuul.project.src_dir }}"
|
|
pull: false
|
|
push: "{{ publish }}"
|
|
tag: "{{ item }}"
|
|
with_items: "{{ image_tags.stdout_lines }}"
|
|
|
|
- shell: "docker images"
|
|
register: docker_images
|
|
|
|
- debug:
|
|
var: docker_images
|
|
|
|
become: True
|