diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index e30f6b5419..63b2e99072 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -97,6 +97,9 @@ esac # Ensure that our shell knows about the new virtualenv hash -r virtualenv +# Load nodepool PIP mirror settings +load_nodepool_pip_opts + # Ensure we use the HTTPS/HTTP proxy with pip if it is specified if [ -n "$HTTPS_PROXY" ]; then PIP_OPTS+="--proxy $HTTPS_PROXY" diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 5c7f17b923..e2c2655ec3 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -81,11 +81,7 @@ log_instance_info run_dstat || true -# If in OpenStack-Infra, set some vars to use the mirror when bootstrapping Ansible -if [[ -e /etc/ci/mirror_info.sh ]]; then - source /etc/ci/mirror_info.sh - export PIP_OPTS="--index-url ${NODEPOOL_PYPI_MIRROR} --trusted-host ${NODEPOOL_MIRROR_HOST} --extra-index-url ${NODEPOOL_WHEEL_MIRROR}" -fi +load_nodepool_pip_opts # Bootstrap Ansible source "${OSA_CLONE_DIR}/scripts/bootstrap-ansible.sh" @@ -169,11 +165,7 @@ if [[ "${ACTION}" == "upgrade" ]]; then unset UPPER_CONSTRAINTS_FILE unset PIP_OPTS - # If in OpenStack-Infra, set some vars to use the mirror when bootstrapping Ansible - if [[ -e /etc/ci/mirror_info.sh ]]; then - source /etc/ci/mirror_info.sh - export PIP_OPTS="--index-url ${NODEPOOL_PYPI_MIRROR} --trusted-host ${NODEPOOL_MIRROR_HOST} --extra-index-url ${NODEPOOL_WHEEL_MIRROR}" - fi + load_nodepool_pip_opts # Source the current scripts-library.sh functions source "${OSA_CLONE_DIR}/scripts/scripts-library.sh" diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index d39c7f7b71..13f8c99631 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -92,6 +92,14 @@ function build_ansible_runtime_venv { fi } +# If in OpenStack-Infra, set some vars to use the mirror when bootstrapping Ansible +function load_nodepool_pip_opts { + if [[ -e /etc/ci/mirror_info.sh ]]; then + source /etc/ci/mirror_info.sh + export PIP_OPTS="--index-url ${NODEPOOL_PYPI_MIRROR} --trusted-host ${NODEPOOL_MIRROR_HOST} --extra-index-url ${NODEPOOL_WHEEL_MIRROR}" + fi +} + # Determine the distribution we are running on, so that we can configure it # appropriately. function determine_distro {