Add option to build containers from package

This patch adds an option to build containers using
tripleoclient and kolla installed via package not
from source keeping default installation via source.

The initial usage of this feature would be to
build containers from cloudsig RDO repos. The idea
is to use same source(packages) for building containers and
content of containers.

Change-Id: Id7cde12a687a1e2a55717ba6fbc0bb78c80c51f6
This commit is contained in:
yatinkarel 2019-12-18 10:38:30 +05:30 committed by yatin
parent ac38bdbb64
commit a5f3a25546
6 changed files with 34 additions and 13 deletions

View File

@ -13,6 +13,7 @@ kolla_base_pull: true
use_buildah: false
buildcontainers_override_repos: ""
buildcontainers_rpm_setup_config: "http://172.17.0.1/delorean.repo,http://172.17.0.1/delorean-{{ ci_branch }}-testing.repo"
buildcontainers_venv: true
openstack_repo_name: delorean
container_cli_opt: ""
# component_ci_containers used by component-ci jobs to build e.g. nova only

View File

@ -77,16 +77,11 @@
changed_when: "'nothing to commit, working directory clean' not in result.stdout_lines"
- name: pip install kolla
pip:
name:
- "file://{{ openstack_git_root }}/kolla"
- "file://{{ openstack_git_root }}/tripleo-common"
- "file://{{ openstack_git_root }}/python-tripleoclient"
- decorator
virtualenv: "{{ workspace }}/venv_build"
virtualenv_python: "{{ virtualenv_python[ansible_pkg_mgr] }}"
virtualenv_site_packages: true
- include_tasks: venv_setup.yml
when: buildcontainers_venv is defined and buildcontainers_venv
- include_tasks: package_setup.yml
when: buildcontainers_venv is defined and not buildcontainers_venv
# TODO(aschultz): make the kolla-build branch aware
- name: Generate kolla-build.conf

View File

@ -0,0 +1,10 @@
- name: install kolla and tripleoclient from package
become: true
package:
name:
- "openstack-kolla"
- "python*-tripleoclient"
- name: set template override
set_fact:
kolla_override_path: "/usr/share/openstack-tripleo-common-containers/container-images/tripleo_kolla_template_overrides.j2"

View File

@ -0,0 +1,14 @@
- name: Installation from source
pip:
name:
- "file://{{ openstack_git_root }}/kolla"
- "file://{{ openstack_git_root }}/tripleo-common"
- "file://{{ openstack_git_root }}/python-tripleoclient"
- decorator
virtualenv: "{{ workspace }}/venv_build"
virtualenv_python: "{{ virtualenv_python[ansible_pkg_mgr] }}"
virtualenv_site_packages: true
- name: set template override
set_fact:
kolla_override_path: "{{ openstack_git_root }}/tripleo-common/container-images/tripleo_kolla_template_overrides.j2"

View File

@ -1,10 +1,11 @@
#!/bin/bash -eux
{% if buildcontainers_venv is defined and buildcontainers_venv %}
source {{ workspace }}/venv_build/bin/activate
pip install -U decorator
{% endif %}
TRIPLEO_COMMON_PATH="{{ openstack_git_root }}/tripleo-common"
TRIPLEO_CI_PATH="{{ openstack_git_root }}/tripleo-ci"
pip install -U decorator
### list containers to build
openstack overcloud container image build {{ container_config }}\
--kolla-config-file {{ workspace }}/kolla-build.conf \

View File

@ -7,7 +7,7 @@ base_tag={{ kolla_base_tag }}
type=binary
registry={{ push_registry }}
tag={{ version_hash }}{{ arch_tag }}
template_override={{ openstack_git_root }}/tripleo-common/container-images/tripleo_kolla_template_overrides.j2
template_override={{ kolla_override_path }}
# we use the repos off the main host as they will already have the correct mirror info in them
rpm_setup_config="{{ buildcontainers_rpm_setup_config }}"
push={{ push_containers }}