diskimage-builder/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash
Ian Wienand c47ee6e121 ubuntu: Add options to ignore mirror components and use insecure repos
When using the upstream cloud images with the "ubuntu" element, they
have universe and multiverse enabled which we don't mirror.

To use the infra mirrors as a DIB_DISTRIBUTION_MIRROR with this
element, we need to be able to skip redirecting to universe and
multiverse, and additionally enable insecure repos (as we don't gpg
sign our mirrors).

Add and document two new variables with the ubuntu element to do this.
This is then setup by the openstack-ci-mirrors element so that we use
local mirrors duing dib functional testing for the "ubuntu" element.

Change-Id: I6ffbde07fa0e103641ee5c5f9d9e854e5b2168dc
2018-10-18 13:53:48 +11:00

45 lines
1.8 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
elif [[ "${DISTRO_NAME}" == "opensuse" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_OPENSUSE_MIRROR
fi
fi
# 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_INSECURE=1
# These repo files are pre-created for the fedora/centos-minimal jobs
# in the gate. Not relevant inside the chroot.
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