diff --git a/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash b/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash index 33ae67c3..d0b37611 100644 --- a/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash +++ b/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash @@ -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 diff --git a/diskimage_builder/elements/opensuse-minimal/README.rst b/diskimage_builder/elements/opensuse-minimal/README.rst index 75023f73..3a01c3f9 100644 --- a/diskimage_builder/elements/opensuse-minimal/README.rst +++ b/diskimage_builder/elements/opensuse-minimal/README.rst @@ -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/`` diff --git a/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash b/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash index 557c4464..c14401b3 100644 --- a/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash +++ b/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash @@ -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 diff --git a/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse423-build-succeeds/element-deps b/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse423-build-succeeds/element-deps new file mode 100644 index 00000000..5d58b59f --- /dev/null +++ b/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse423-build-succeeds/element-deps @@ -0,0 +1 @@ +openstack-ci-mirrors diff --git a/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash b/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash index 6291ed39..1abd30c0 100644 --- a/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash +++ b/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash @@ -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} diff --git a/diskimage_builder/elements/opensuse/test-elements/build-succeeds/element-deps b/diskimage_builder/elements/opensuse/test-elements/build-succeeds/element-deps new file mode 100644 index 00000000..5d58b59f --- /dev/null +++ b/diskimage_builder/elements/opensuse/test-elements/build-succeeds/element-deps @@ -0,0 +1 @@ +openstack-ci-mirrors diff --git a/diskimage_builder/elements/zypper-minimal/README.rst b/diskimage_builder/elements/zypper-minimal/README.rst index 8fcda2ea..eb433522 100644 --- a/diskimage_builder/elements/zypper-minimal/README.rst +++ b/diskimage_builder/elements/zypper-minimal/README.rst @@ -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 diff --git a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot index 38934d90..7d139eb0 100755 --- a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot +++ b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot @@ -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##*=>}