tripleo-ci/roles/oooci-build-images/templates/build-images.sh.j2

79 lines
2.3 KiB
Django/Jinja

set -ex
# 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-uefi-full" %}
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-uefi-python3.yaml \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-uefi-{{ tripleo_image_os }}.yaml"
{% elif tripleo_image_type == "overcloud-hardened-full" %}
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/{{ hardened_image_config[python_v] }} \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-{{ tripleo_image_os }}.yaml"
{% else %}
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/{{ base_image_config[python_v] }} \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-images-{{ tripleo_image_os }}.yaml"
{% endif %}
{% if dib_local_image is defined %}
# this is only set in rhel/centos-8 jobs dib_rhel_image -> DIB_LOCAL_IMAGE
export DIB_LOCAL_IMAGE={{ dib_local_image }}
{% endif %}
{% if dib_node_dist is defined %}
export NODE_DIST={{ dib_node_dist }}
export DISTRO_NAME={{ dib_node_dist }}
{% endif %}
{% if dib_release is defined %}
export DIB_RELEASE={{ dib_release }}
{% endif %}
{% if dib_yum_repo_conf is defined %}
export DIB_YUM_REPO_CONF='{{ dib_yum_repo_conf | join(" ") }}'
{% else %}
export DIB_YUM_REPO_CONF="/etc/yum.repos.d/delorean*"
{% endif %}
{% if dib_dnf_module_streams is defined and dib_dnf_module_streams|length > 0 %}
export DIB_DNF_MODULE_STREAMS='{{ dib_dnf_module_streams }}'
{% endif %}
export DIB_DEBUG_TRACE=1
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