elements: openstack-ci-mirrors: Use openSUSE mirrors for gating jobs

In preparation for promoting the openSUSE jobs to voting ones we should
use the OpenStack mirrors. As such, the opensuse elements are modified
to make use of the DIB_DISTRIBUTION_MIRROR variable which is normally
exported by the openstack-ci-mirrors element.

Change-Id: Ie588c1c1eec13190cfb2ec718ba51f8c9878283f
This commit is contained in:
Markos Chandras 2017-06-28 09:53:38 +01:00
parent 3457d2f8e8
commit 6be09152c2
8 changed files with 30 additions and 47 deletions

View file

@ -21,6 +21,8 @@ if [ -f /etc/ci/mirror_info.sh ]; 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

View file

@ -15,14 +15,3 @@ DIB_RELEASE
:Required: No
:Default: 42.2
:Description: Set the desired openSUSE release.
DIB_OPENSUSE_MIRROR:
:Required: No
:Default: http://download.opensuse.org
:Description: To use a specific openSUSE mirror, set this variable to the
mirror URL before running bin/disk-image-create. This URL
should point to the root directory as indicated in the
http://mirrors.opensuse.org/ webpage. You normally
don't want to change that since the default setting will
pick the mirror closest to you.
:Example: ``DIB_OPENSUSE_MIRROR=http://ftp.cc.uoc.gr/mirrors/linux/opensuse/opensuse/``

View file

@ -1,27 +1,4 @@
export DISTRO_NAME=opensuse
DIB_RELEASE=${DIB_RELEASE:-42.2}
export DIB_RELEASE=${DIB_RELEASE,,}
export DIB_OPENSUSE_MIRROR=${DIB_OPENSUSE_MIRROR:-http://download.opensuse.org}
export DIB_OPENSUSE_PATTERNS=patterns-openSUSE-base
case ${DIB_RELEASE} in
# We are using "=>" as the assignment symbol since "@" "=" etc could be used in the URI itself.
# Remember, we can't export an array in bash so we use a string instead.
# Repo format: {name}=>{uri}
# Old openSUSE releases
13*)
ZYPPER_REPOS="update=>${DIB_OPENSUSE_MIRROR}/update/${DIB_RELEASE}/ "
ZYPPER_REPOS+="oss=>${DIB_OPENSUSE_MIRROR}/distribution/${DIB_RELEASE}/repo/oss/"
;;
# New Leap releases
42*)
ZYPPER_REPOS="update=>${DIB_OPENSUSE_MIRROR}/update/leap/${DIB_RELEASE}/oss/ "
ZYPPER_REPOS+="oss=>${DIB_OPENSUSE_MIRROR}/distribution/leap/${DIB_RELEASE}/repo/oss/"
;;
# Tumbleweed
tumbleweed)
ZYPPER_REPOS="update=>${DIB_OPENSUSE_MIRROR}/update/${DIB_RELEASE}/ "
ZYPPER_REPOS+="oss=>${DIB_OPENSUSE_MIRROR}/${DIB_RELEASE}/repo/oss/"
;;
*) echo "Unsupported openSUSE release: ${DIB_RELEASE}"; exit 1 ;;
esac
export ZYPPER_REPOS

View file

@ -8,3 +8,5 @@ case ${DIB_RELEASE} in
42*) export OPENSUSE_REPO_DIR=openSUSE_Leap_${DIB_RELEASE} ;;
*) echo "Unsupported openSUSE release: ${DIB_RELEASE}"; exit 1 ;;
esac
export DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-http://download.opensuse.org}

View file

@ -0,0 +1 @@
openstack-ci-mirrors

View file

@ -6,14 +6,3 @@ Base element for creating minimal SUSE-based images
This element is incomplete by itself so you probably want to use it along
with the opensuse-minimal one. It requires 'zypper' to be installed on the
host.
Repositories
------------
This element expects the `ZYPPER_REPOS` variable to be exported by the
operating system element. This variable contains repository mappings in
the following format: `${repo_name}==>${repo_url}`. For example::
ZYPPER_REPOS="update=>http://download.opensuse.org/update/leap/42.2/oss/ "
ZYPPER_REPOS+="oss=>http://download.opensuse.org/distribution/leap/42.2/repo/oss/"
export ZYPPER_REPOS

View file

@ -24,8 +24,6 @@ fi
set -eu
set -o pipefail
[ -n "${ZYPPER_REPOS}" ]
function cleanup() {
sudo umount $TARGET_ROOT/proc
sudo umount $TARGET_ROOT/dev/pts
@ -39,6 +37,30 @@ trap cleanup EXIT
ZYPPER_TARGET_OPTS="--non-interactive --gpg-auto-import-keys --root $TARGET_ROOT"
ZYPPER_INSTALL_OPTS="--no-recommends"
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-http://download.opensuse.org}
case ${DIB_RELEASE} in
# We are using "=>" as the assignment symbol since "@" "=" etc could be used in the URI itself.
# Remember, we can't export an array in bash so we use a string instead.
# Repo format: {name}=>{uri}
# Old openSUSE releases
13*)
ZYPPER_REPOS="update=>${DIB_DISTRIBUTION_MIRROR}/update/${DIB_RELEASE}/ "
ZYPPER_REPOS+="oss=>${DIB_DISTRIBUTION_MIRROR}/distribution/${DIB_RELEASE}/repo/oss/"
;;
# New Leap releases
42*)
ZYPPER_REPOS="update=>${DIB_DISTRIBUTION_MIRROR}/update/leap/${DIB_RELEASE}/oss/ "
ZYPPER_REPOS+="oss=>${DIB_DISTRIBUTION_MIRROR}/distribution/leap/${DIB_RELEASE}/repo/oss/"
;;
# Tumbleweed
tumbleweed)
ZYPPER_REPOS="update=>${DIB_DISTRIBUTION_MIRROR}/update/${DIB_RELEASE}/ "
ZYPPER_REPOS+="oss=>${DIB_DISTRIBUTION_MIRROR}/${DIB_RELEASE}/repo/oss/"
;;
*) echo "Unsupported openSUSE release: ${DIB_RELEASE}"; exit 1 ;;
esac
for repo in ${ZYPPER_REPOS}; do
reponame=repo-${repo%%=>*}
repouri=${repo##*=>}