a1ea2cc753
Without this monasca images are not built unless explicitly requested. Monasca images only support the kolla source type, not binary. Also fixes image builds if the list of regular expressions for an image build set is empty, kolla will build all images. In our case we actually want to build none, since it means that no services are enabled for that image set. The main example of where this could happen is when monasca is disabled, the list of source-only images will be empty. Change-Id: I395e73a06b690d4b443af7c5eb8827514f56d03d TrivialFix
57 lines
2.1 KiB
YAML
57 lines
2.1 KiB
YAML
---
|
|
- name: Ensure Kolla container images are built
|
|
hosts: container-image-builders
|
|
vars:
|
|
# Set this to True to push images to the registry when built.
|
|
push_images: False
|
|
# Set this variable to a space-separated list of regexes to override the
|
|
# default set of images.
|
|
container_image_regexes: ""
|
|
kolla_build_log_path: "/var/log/kolla-build.log"
|
|
tasks:
|
|
- name: Set the container image sets to build if images regexes specified
|
|
set_fact:
|
|
container_image_sets:
|
|
- regexes: "{{ container_image_regexes }}"
|
|
when: container_image_regexes != ''
|
|
|
|
- name: Display the regexes for container images that will be built
|
|
debug:
|
|
msg: >
|
|
Building container images of type
|
|
'{{ item.type | default(kolla_install_type) }}' matching
|
|
'{{ item.regexes }}'. Build logs will be appended to
|
|
{{ kolla_build_log_path }}.
|
|
with_items: "{{ container_image_sets }}"
|
|
|
|
- name: Ensure Kolla build log file exists
|
|
file:
|
|
path: "{{ kolla_build_log_path }}"
|
|
state: touch
|
|
owner: "{{ ansible_user_uid }}"
|
|
group: "{{ ansible_user_gid }}"
|
|
become: True
|
|
|
|
- name: Login to docker registry
|
|
docker_login:
|
|
registry_url: "{{ kolla_docker_registry or omit }}"
|
|
username: "{{ kolla_docker_registry_username }}"
|
|
password: "{{ kolla_docker_registry_password }}"
|
|
reauthorize: yes
|
|
when:
|
|
- kolla_docker_registry_username is not none
|
|
- kolla_docker_registry_password is not none
|
|
|
|
- name: Ensure Kolla container images are built
|
|
shell: >
|
|
set -o pipefail &&
|
|
source {{ kolla_venv }}/bin/activate &&
|
|
kolla-build \
|
|
--config-dir {{ kolla_build_config_path }} \
|
|
{% if item.type is defined %}--type {{ item.type }}{% endif %} \
|
|
{% if kolla_docker_registry is not none %}--registry {{ kolla_docker_registry }}{% endif %} \
|
|
{% if push_images | bool %}--push{% endif %} \
|
|
{{ item.regexes }} 2>&1 | tee --append {{ kolla_build_log_path }}
|
|
with_items: "{{ container_image_sets }}"
|
|
when: item.regexes != ''
|