Set EPEL mirror during openstack-ci-mirrors

We want to set DIB_EPEL_MIRROR for the epel element, which means we
need access to the CI mirror info script in the chroot.  Copy it into
the temp directory with extra-data.d and update the environment file
to find it.

Change-Id: Ia12f0cbdeb194eef3155497ceb5ffc4a452aad76
This commit is contained in:
Ian Wienand 2018-10-10 10:50:34 +11:00
parent c47ee6e121
commit 8b0111477e
2 changed files with 52 additions and 23 deletions

View File

@ -1,10 +1,21 @@
# Set DIB_DISTRIBUTION_MIRROR if running in openstack gate # Set DIB_DISTRIBUTION_MIRROR and related if running in openstack gate
if [ -f /etc/ci/mirror_info.sh ]; then
# don't spam logs with this source # don't spam logs with this source
_xtrace=$(set +o | grep xtrace) _xtrace=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
source /etc/ci/mirror_info.sh
if [ -f /etc/ci/mirror_info.sh ]; then
# outside chroot
mirror_info=/etc/ci/mirror_info.sh
elif [ -f /tmp/in_target.d/mirror_info.sh ]; then
# inside chroot
mirror_info=/tmp/in_target.d/mirror_info.sh
else
echo "No mirror file found. Not an OpenStack CI node?"
return 0
fi
source $mirror_info
$_xtrace $_xtrace
# note 11- is after 10- which is where DISTRO_NAME is set usually # note 11- is after 10- which is where DISTRO_NAME is set usually
@ -19,14 +30,14 @@ if [ -f /etc/ci/mirror_info.sh ]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_FEDORA_MIRROR export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_FEDORA_MIRROR
elif [[ "${DISTRO_NAME}" == "centos" ]]; then elif [[ "${DISTRO_NAME}" == "centos" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR
export DIB_EPEL_MIRROR=$NODEPOOL_EPEL_MIRROR
elif [[ "${DISTRO_NAME}" == "centos7" ]]; then elif [[ "${DISTRO_NAME}" == "centos7" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR
export DIB_EPEL_MIRROR=$NODEPOOL_EPEL_MIRROR
elif [[ "${DISTRO_NAME}" == "opensuse" ]]; then elif [[ "${DISTRO_NAME}" == "opensuse" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_OPENSUSE_MIRROR export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_OPENSUSE_MIRROR
fi fi
fi
# Infra doesn't mirror non-free repos, so instruct to ignore these # Infra doesn't mirror non-free repos, so instruct to ignore these
export DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE="(universe|multiverse)" export DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE="(universe|multiverse)"
export DIB_DISTRIBUTION_MIRROR_UBUNTU_INSECURE=1 export DIB_DISTRIBUTION_MIRROR_UBUNTU_INSECURE=1
@ -42,3 +53,4 @@ if [[ -d ${WORKSPACE:-/not/a/path/}/dib-mirror ]]; then
fi fi
fi fi

View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# On infra nodes, make a copy of the mirror_info.sh script inside the
# chroot for elements running in chroot like EPEL that want to
# reference it.
mirror_info=/etc/ci/mirror_info.sh
if [ -f $mirror_info ]; then
cp /etc/ci/mirror_info.sh $TMP_HOOKS_PATH/mirror_info.sh
fi