#!/bin/bash -eux {% if buildcontainers_venv is defined and buildcontainers_venv %} source {{ workspace }}/venv_build/bin/activate pip install -U decorator TRIPLEO_COMMON_PATH="{{ openstack_git_root }}/{% if zuul_internal is defined %}openstack-{% endif %}tripleo-common" {% else %} TRIPLEO_COMMON_PATH="/usr/share/openstack-tripleo-common" {% endif %} TRIPLEO_CI_PATH="{{ ansible_user_dir }}/src/opendev.org/openstack/tripleo-ci" export TRIPLEO_CI_USR_PATH="${VIRTUAL_ENV:-/usr}" export TRIPLEO_ANSIBLE_WORKPATH="${TRIPLEO_CI_USR_PATH}/share/ansible" export ANSIBLE_ACTION_PLUGINS="${TRIPLEO_ANSIBLE_WORKPATH}/plugins/action" export ANSIBLE_CALLBACK_PLUGINS="${TRIPLEO_ANSIBLE_WORKPATH}/plugins/callback" export ANSIBLE_FILTER_PLUGINS="${TRIPLEO_ANSIBLE_WORKPATH}/plugins/filter" export ANSIBLE_LIBRARY="${TRIPLEO_ANSIBLE_WORKPATH}/plugins/modules" export ANSIBLE_MODULE_UTILS="${TRIPLEO_ANSIBLE_WORKPATH}/plugins/module_utils" export ANSIBLE_ROLES_PATH="${TRIPLEO_ANSIBLE_WORKPATH}/roles" export ROLE_REPOS="tripleo-common ansible/roles" echo "print exported variables" set | grep -i TRIPLEO set | grep -i ANSIBLE echo "list files in ansible role path, ${TRIPLEO_ANSIBLE_WORKPATH}/roles" ls -la "${TRIPLEO_ANSIBLE_WORKPATH}/roles" # Ensure that the roles from tripleo-common and tripleo-ansible installed # from the venv are available in the roles path # The tripleo-common role path can be found here: # https://opendev.org/openstack/tripleo-common/src/branch/master/tripleo_common/actions/ansible.py for ROLE_REPO in $ROLE_REPOS; do if [[ "${TRIPLEO_CI_USR_PATH}" != '/usr' && -d "${TRIPLEO_CI_USR_PATH}/share/${ROLE_REPO}" ]]; then # Check if the target directory exists and is not a symlink if [[ -d "/usr/share/${ROLE_REPO}" && ! -L "/usr/share/${ROLE_REPO}" ]]; then echo "Creating a backup of /usr/share/${ROLE_REPO}.bak" sudo mv /usr/share/${ROLE_REPO} /usr/share/${ROLE_REPO}.bak fi # Link our venv'd ${ROLE_REPO} files into the root path. echo -e "Linking ${TRIPLEO_CI_USR_PATH}/share/${ROLE_REPO} to /usr/share/${ROLE_REPO}" sudo ln -sf ${TRIPLEO_CI_USR_PATH}/share/${ROLE_REPO} /usr/share/${ROLE_REPO} fi done ### build openstack tripleo container image build \ {% if push_containers|bool %} --push \ {% endif %} {% if buildcontainers_authfile_path is defined %} --authfile {{ buildcontainers_authfile_path }} \ {% endif %} {% if distro is defined %} --distro {{ distro }} \ {% endif %} {% if registry_namespace is defined %} --namespace {{ registry_namespace }} \ {% endif%} {% if push_registry is defined %} --registry {{ push_registry }} \ {% endif %} {% if rhel_modules is defined %} --rhel-modules {{ rhel_modules | join(",") }} \ {% endif %} {% set branch = osp_branch|default(ci_branch) %} {% if branch in exclude_containers %} {% for item in exclude_containers[branch][container_exclude_distro] %} --exclude {{ item }} \ {% endfor %} {% endif %} --tag {{ version_hash }}{{ arch_tag | default('') }}\ --base {{ containers_base_image | default('ubi8') }} \ --prefix {{ container_name_prefix }} \ --config-file {{ openstack_git_root }}/{% if zuul_internal is defined %}openstack-{% endif %}tripleo-common/container-images/tripleo_containers.yaml \ --config-path {{ openstack_git_root }}/{% if zuul_internal is defined %}openstack-{% endif %}tripleo-common/container-images \ --work-dir {{ ansible_user_dir }}/container-builds \ {% if build_timeout is defined %} --build-timeout {{ build_timeout }} \ {% endif %} {% if dockerfile_labels is defined %} {% for item in dockerfile_labels %} --label {{ item }} \ {% endfor %} {% endif %} {% if volume_mounts is defined %} {% for item in volume_mounts %} --volume {{ item }} \ {% endfor %} {% endif %} {% if release|default(branch) not in ["train"] %} --tcib-extra tcib_release={{ ansible_distribution_major_version }} \ --tcib-extra tcib_python_version={{ (ansible_distribution_major_version is version('9', '<')) | ternary ('3.6', '3.9') }} \ {% endif %} {% if (tcib_extra_config is defined) and (release|default(branch) not in ["train", "wallaby"]) %} --extra-config {{ workspace }}/extra_config.yaml \ {% endif %} # TODO(tkajinam): With Ansible 2.14, the playbook triggered by the command # gets stuck if -vvv is set. We temporarily remove --debug # as a workaround until we find out the appropriate fix. # https://github.com/ansible/ansible-runner/issues/1164 # --debug