diskimage-builder/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash
Ian Wienand 649f0b66d9 Start at using CI mirrors for fedora/centos
fedora/centos-minimal don't obey DIB_DISTRIBUTION_MIRROR currently.  I
don't really want them too -- we want to be able to separate the
mirrors used during the build process from those embedded into the
final image.  Add DIB_YUM_MINIMAL_BOOTSTRAP_REPOS which is a directory
with repo files to use during the install.

This introduces setup-gate-mirrors.sh which is intended to setup
repo/sources/whatever files in the openstack gate that point to the
local region mirror.  It pulls the info from the mirror_info.sh script
on each CI node.

The openstack-ci-mirrors element is updated to export these variables.
elements are updated to depend on it.  Tests are restored

Change-Id: I7604fc4d41cb1483be16b8d628a24e8fc764f515
2017-06-21 12:02:27 +10:00

39 lines
1.4 KiB
Bash

# Set DIB_DISTRIBUTION_MIRROR if running in openstack gate
if [ -f /etc/ci/mirror_info.sh ]; then
# don't spam logs with this source
_xtrace=$(set +o | grep xtrace)
set +o xtrace
source /etc/ci/mirror_info.sh
$_xtrace
# note 11- is after 10- which is where DISTRO_NAME is set usually
if [[ "${DISTRO_NAME}" == "ubuntu" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_UBUNTU_MIRROR
export DIB_DEBOOTSTRAP_EXTRA_ARGS+=" --no-check-gpg"
elif [[ "${DISTRO_NAME}" == "debian" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_DEBIAN_MIRROR
export DIB_DEBOOTSTRAP_EXTRA_ARGS+=" --no-check-gpg"
elif [[ "${DISTRO_NAME}" == "fedora" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_FEDORA_MIRROR
elif [[ "${DISTRO_NAME}" == "centos" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR
elif [[ "${DISTRO_NAME}" == "centos7" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR
fi
fi
# This is repo files pre-created for the fedora/centos-minimal jobs in
# the gate
if [[ -d ${WORKSPACE:-/not/a/path/}/dib-mirror ]]; then
if [[ "${DISTRO_NAME}" == "fedora" ]]; then
export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${WORKSPACE}/dib-mirror/fedora-minimal/yum.repos.d
elif [[ "${DISTRO_NAME}" == "centos" ]]; then
export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${WORKSPACE}/dib-mirror/centos-minimal/yum.repos.d
fi
fi