Fix oooci-build-images role to consume with build-image

In order to consume with oooci-build-images role with TQE
build-images role, it needs following changes:
* Install python-tripleoclient as pre.yaml will be not running all
  the stuff will be consumed via rpm only and it enabled only
  when to_build param is defined.
* Activate virtualenv only when venv exists
* Add role under setup.cfg so that TQ discovers it in runtime
* Put openstack/tripleo-ci as external repos so that toci script
  will copy and install the required roles.
* Added build_all_images var to build both overcloud and IPA images.
  It defaults to false.

Change-Id: Iabe30da1672c40d684cbf718abecb0040ae699f2
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
Chandan Kumar (raukadah) 2020-04-20 12:36:00 +05:30
parent 874d54e615
commit a34719ac32
5 changed files with 31 additions and 5 deletions

View File

@ -39,3 +39,4 @@ dib_yum_repo_conf_rhel:
- /etc/yum.repos.d/delorean*
dib_release: "8"
tripleo_image_os: centos8
build_all_images: false

View File

@ -33,6 +33,15 @@
state: present
become: true
- name: Install python-tripleoclient for Image build
package:
name: "python*-tripleoclient"
state: present
become: true
when:
- to_build is defined
- to_build | bool
- name: Generate build-images.sh script
template:
src: templates/build-images.sh.j2

View File

@ -1,12 +1,24 @@
set -x
source {{ workspace }}/venv/bin/activate
# Activate virtualenv only if exists
if [ -d "{{ workspace }}/venv" ]; then
source {{ workspace }}/venv/bin/activate
fi
# When python-tripleoclient is installed via packages
# elements_path are automatically setted.
{% if to_build is not defined %}
ELEMENTS="{{ tripleo_elements_path | join(':') }}"
if [ -d "{{ openstack_git_root }}/instack-undercloud/elements" ]; then
ELEMENTS="{{ openstack_git_root }}/instack-undercloud/elements:${ELEMENTS}"
fi
export ELEMENTS_PATH=$ELEMENTS
{% endif %}
# the tripleo_image_type is set and passed from the ci job definition
if [ "{{ tripleo_image_type }}" == "overcloud-hardened-full" ]; then
CONFIG_FILES="--config-file \
@ -51,9 +63,8 @@ export DIB_YUM_REPO_CONF="/etc/yum.repos.d/delorean*"
export DIB_DEBUG_TRACE=1
export ELEMENTS_PATH=$ELEMENTS
openstack --debug overcloud image build --image-name {{ tripleo_image_type }} $CONFIG_FILES > {{ workspace }}/build.log 2> {{ workspace }}/build-err.log
openstack --debug overcloud image build {% if not build_all_images|bool %}--image-name {{ tripleo_image_type }}{% endif %} \
$CONFIG_FILES > {{ workspace }}/build.log 2> {{ workspace }}/build-err.log
RESULT=$?
exit $RESULT

View File

@ -136,7 +136,7 @@ fi
# Import gated external repo in oooq - starting with browbeat, tripleo-ha-utils, openstack-ansible-os_tempest,
# ansible-config_template, ansible-role-python_venv_build, ansible-role-collect-logs
EXTERNAL_REPOS="x/browbeat openstack/tripleo-ha-utils openstack/tripleo-quickstart-extras openstack/openstack-ansible-os_tempest \
EXTERNAL_REPOS="x/browbeat openstack/tripleo-ha-utils openstack/tripleo-ci openstack/tripleo-quickstart-extras openstack/openstack-ansible-os_tempest \
openstack/ansible-config_template openstack/ansible-role-python_venv_build openstack/ansible-role-collect-logs \
openstack/tripleo-operator-ansible"
for EXTERNAL_REPO in $EXTERNAL_REPOS; do

View File

@ -19,6 +19,11 @@ classifier =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
[files]
data_files =
usr/local/share/ansible/roles = roles/*
[egg_info]
tag_build =
tag_date = 0