Allow to use own repos.y[a]ml file to build containers

Followup the I0b07da22fea27e0ff4e90aaad19e50d84ff9a121 from Kolla.
This change allow to use own repos.y[a]ml file to build containers.
Multiple Environments supported.

Change-Id: I0d7ab0d8ff5b16ac5de8e50e63400bd455996555
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
This commit is contained in:
Maksim Malchuk 2022-06-09 22:54:07 +03:00 committed by Mark Goddard
parent 137e64b57c
commit 070621a45d
4 changed files with 38 additions and 0 deletions

View File

@ -1,4 +1,30 @@
---
- name: Set facts for repos.y[a]ml
set_fact:
repos_yaml_dest: "{{ kolla_build_config_path }}/repos.yml"
repos_yaml_sources: "{{ kolla_build_config_paths | product(['/kolla/repos.yaml', '/kolla/repos.yml']) | map('join') | unique | list }}"
- name: Check for the presence of any custom repos.y[a]ml file
stat:
path: "{{ item }}"
get_md5: False
get_checksum: False
mime: False
with_items: "{{ repos_yaml_sources }}"
register: repos_yaml_stat
- name: Set kolla_build_repos_yaml_path if any custom repos.y[a]ml file exists
set_fact:
kolla_build_repos_yaml_path: "{{ repos_yaml_dest }}"
when: repos_yaml_stat.results | map(attribute='stat.exists') | select | length > 0
- name: Ensure the Kolla repos.yaml configuration file exists
merge_yaml:
sources: "{{ repos_yaml_sources }}"
dest: "{{ repos_yaml_dest }}"
mode: 0644
when: kolla_build_repos_yaml_path is defined
- name: Ensure the Kolla build configuration file exists
merge_configs:
sources: "{{ kolla_build_config_paths | product(['/kolla/kolla-build.conf']) | map('join') | list }}"

View File

@ -16,6 +16,10 @@ network_mode=host
# Docker image tag to apply.
tag={{ kolla_tag }}
{% if kolla_build_repos_yaml_path is defined %}
# Path to a file containing repos overrides.
repos_yaml={{ kolla_build_repos_yaml_path }}
{% endif %}
# Path to a file containing template overrides.
template_override={{ kolla_build_config_path }}/template-override.j2

View File

@ -163,6 +163,7 @@ environment-specific and shared configuration file content:
* ``kolla/config/bifrost/servers.yml``
* ``kolla/globals.yml``
* ``kolla/kolla-build.conf``
* ``kolla/repos.yml`` or ``kolla/repos.yaml``
Options in the environment-specific files take precedence over those in the
shared files.

View File

@ -0,0 +1,7 @@
---
features:
- |
Since Kolla containers can built with user provided ``repos.yaml`` Kayobe
can override the file with their own content. The override files can be
``${KAYOBE_CONFIG_PATH}/kolla/repos.yaml`` (default Kolla filename) or
``${KAYOBE_CONFIG_PATH}/kolla/repos.yml``. Multiple Environments supported.