magnum/playbooks/container-builder.yaml
Bharat Kunwar 7be7a5a123 [hca] Use wallaby-stable-1 as default HCA tag
Additionally:
- update syntax for compatibility with Ansible 2.9+.
- explicitly check for "not found" to prevent rebuild due to
  other types of errors, e.g. "pull rate limit".

Story: 2007264
Task: 42009

Change-Id: I68ca057e500ea293bde398288432a67eb758af25
2021-03-09 11:46:49 +00:00

76 lines
3.0 KiB
YAML

- hosts: all
tasks:
- include_vars: container-builder-vars.yaml
# NOTE: By default, stable images are not built if they already exist.
# Assigning dev=true property for heat container agent images means that a new
# image is re-built and pushed under the same tag every time.
- name: "Build heat-container-agent images"
block:
- name: "Check if {{ magnum_repository }}/heat-container-agent:{{ item.tag }} exists"
docker_image:
name: "{{ magnum_repository }}/heat-container-agent"
tag: "{{ item.tag }}"
source: pull
register: docker_output
when: not (item.dev | default(false) | bool)
failed_when: (docker_output is failed and "pull rate limit" in docker_output.msg)
with_items: "{{ heat_container_agent_images }}"
- name: "Build {{ magnum_repository }}/heat-container-agent:{{ item.item.tag }} image"
docker_image:
build:
path: "{{ magnum_src_dir }}/dockerfiles/heat-container-agent"
name: "{{ magnum_repository }}/heat-container-agent"
tag: "{{ item.item.tag }}"
push: no
source: build
with_items: "{{ docker_output.results }}"
when: ("msg" in item and "not found" in item.msg) or (item.item.dev | default(false) | bool)
retries: 10
- name: "Build kubernetes images"
block:
- name: "Build {{ magnum_repository }}/{{ item[1].name }}:{{ item[0].version }} image"
docker_image:
name: "{{ magnum_repository }}/{{ item[1].name }}"
tag: "{{ item[0].version }}"
build:
path: "{{ magnum_src_dir }}/dockerfiles/{{ item[1].name }}"
args:
KUBE_VERSION: "{{ item[0].version }}"
push: no
source: build
with_nested:
- "{{ kubernetes_versions }}"
- "{{ kubernetes_images }}"
retries: 10
- name: "Build helm-client image"
block:
- docker_image:
name: "{{ magnum_repository }}/helm-client"
tag: "{{ item.version }}"
build:
path: "{{ magnum_src_dir }}/dockerfiles/helm-client"
args:
HELM_VERSION: "{{ item.version }}"
push: no
source: build
with_items: "{{ helm_versions }}"
retries: 10
- name: "Build cluster-autoscaler image"
block:
- name: "Build {{ magnum_repository }}/cluster-autoscaler:v{{ item.version }}"
docker_image:
name: "{{ magnum_repository }}/cluster-autoscaler"
tag: "v{{ item.version }}"
build:
path: "{{ magnum_src_dir }}/dockerfiles/cluster-autoscaler"
args:
AUTOSCALER_VERSION: "cluster-autoscaler-{{ item.version }}"
push: no
source: build
with_items: "{{ cluster_autoscaler_versions }}"
retries: 10