-
Notifications
You must be signed in to change notification settings - Fork 9
Element for building previous releases of CentOS 7 #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| ============= | ||
| centos7-vault | ||
| ============= | ||
|
|
||
| Based on the standard centos7 element with minimal changes. | ||
|
|
||
| Use previous (but still available) versions of CentOS 7 cloud images as | ||
| the baseline for built disk images. | ||
|
|
||
| DIB_CENTOS7_VERSION: | ||
| :Required: No | ||
| :Default: 7.6 | ||
| :Description: Set a version, from 7.1 to 7.7 (inclusive) and the last-known | ||
| public locations for package repos and cloud images will be used. | ||
|
|
||
| DIB_CENTOS7_MIRROR_VERSION: | ||
| :Required: No | ||
| :Default: 7.6.1810 | ||
| :Description: Set a fully-qualified version for a build of CentOS. | ||
| A sensible last-known default value is set according to | ||
| ``DIB_CENTOS7_VERSION``. This value also overwrites | ||
| ``$releasever`` in a standard ``CentOS-Base`` yum repo. | ||
|
|
||
| DIB_CENTOS7_CLOUDIMAGE_VERSION: | ||
| :Required: No | ||
| :Default: GenericCloud-1811 | ||
| :Description: Set a fully-qualified version for a cloud image build. | ||
| A sensible last-known default value is set according to | ||
| ``DIB_CENTOS7_VERSION``. | ||
|
|
||
| DIB_CENTOS7_MIRROR: | ||
| :Required: No | ||
| :Default: ``http://vault.centos.org`` | ||
| :Description: A default value is the CentOS vault repo URL. | ||
| It must have a subdirectory which is the CentOS mirror version. | ||
| :Example: ``DIB_DISTRIBUTION_MIRROR=http://mirror.local/centos`` | ||
|
|
||
| DIB_CENTOS7_CLOUDIMAGE_REPO: | ||
| :Required: No | ||
| :Default: ``https://cloud.centos.org/centos/7/images`` | ||
| :Description: URL to a folder for fetching the cloud image. | ||
|
|
||
| DIB_CENTOS7_CLOUDIMAGE: | ||
| :Required: No | ||
| :Default: ``https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-$DIB_CENTOS7_CLOUDIMAGE_VERSION.qcow2.xz`` | ||
| :Description: Set the desired fully-qualified URL to fetch the cloud image from. | ||
| :Example: ``DIB_CLOUD_IMAGES=/path/to/my/centos/7/CentOS-7-x86_64-GenericCloud.qcow2.xz`` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cache-url | ||
| redhat-common | ||
| rpm-distro | ||
| source-repositories | ||
| yum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| operating-system |
62 changes: 62 additions & 0 deletions
62
elements/centos7-vault/environment.d/10-centos7-distro-name.bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| export DISTRO_NAME=centos7 | ||
| export DIB_RELEASE=7 | ||
|
|
||
| # Useful for elements that work with fedora (dnf) & centos | ||
| export YUM=${YUM:-yum} | ||
|
|
||
| # At the time of writing CentOS 7.7 is still current and the vault content is incomplete. | ||
| export DIB_CENTOS7_VERSION=${DIB_CENTOS7_VERSION:-"7.6"} | ||
| case "$DIB_CENTOS7_VERSION" in | ||
| 7.7) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.7.1908"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1907"} | ||
| ;; | ||
| 7.6) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.6.1810"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1811"} | ||
| ;; | ||
| 7.5) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.5.1804"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1805"} | ||
| ;; | ||
| 7.4) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.4.1708"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1708"} | ||
| ;; | ||
| 7.3) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.3.1611"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1611"} | ||
| ;; | ||
| 7.2) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.2.1511"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1511"} | ||
| ;; | ||
| 7.1) | ||
| DIB_CENTOS7_MIRROR_VERSION=${DIB_CENTOS7_MIRROR_VERSION:-"7.1.1503"} | ||
| DIB_CENTOS7_CLOUDIMAGE_VERSION=${DIB_CENTOS7_CLOUDIMAGE_VERSION:-"GenericCloud-1503"} | ||
| ;; | ||
| *) | ||
| echo "CentOS 7 version \"$DIB_CENTOS7_VERSION\" is not recognised" | ||
| exit -1 | ||
| ;; | ||
| esac | ||
| export DIB_CENTOS7_MIRROR_VERSION DIB_CENTOS7_CLOUDIMAGE_VERSION | ||
|
|
||
| [ -n "$ARCH" ] | ||
|
|
||
| if [[ "amd64 x86_64" =~ "$ARCH" ]]; then | ||
| ARCH="x86_64" | ||
| export DIB_CENTOS7_CLOUDIMAGE_REPO=${DIB_CENTOS7_CLOUDIMAGE_REPO:-"https://cloud.centos.org/centos/7/images"} | ||
| elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then | ||
| ARCH="aarch64" | ||
| export DIB_CENTOS7_CLOUDIMAGE_REPO=${DIB_CENTOS7_CLOUDIMAGE_REPO:-http://cloud.centos.org/altarch/7/images/aarch64} | ||
| elif [[ "ppc64le" =~ "$ARCH" ]]; then | ||
| export DIB_CENTOS7_CLOUDIMAGE_REPO=${DIB_CENTOS7_CLOUDIMAGE_REPO:-http://cloud.centos.org/altarch/7/images/ppc64le} | ||
| else | ||
| echo 'centos7-vault root element only supports the x86_64, aarch64 and ppc64le values for $ARCH' | ||
| exit -2 | ||
| fi | ||
|
|
||
| export DIB_CENTOS7_MIRROR=${DIB_CENTOS7_MIRROR:-"http://vault.centos.org"} | ||
| export DIB_CENTOS7_CLOUDIMAGE_FILE=${DIB_CENTOS7_CLOUDIMAGE_FILE:-CentOS-7-${ARCH}-${DIB_CENTOS7_CLOUDIMAGE_VERSION}.qcow2.xz} | ||
| export DIB_CENTOS7_CLOUDIMAGE=${DIB_CENTOS7_CLOUDIMAGE:-${DIB_CENTOS7_CLOUDIMAGE_REPO}/${DIB_CENTOS7_CLOUDIMAGE_FILE}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then | ||
| set -x | ||
| fi | ||
| set -eu | ||
| set -o pipefail | ||
|
|
||
|
|
||
| # Only set the mirror for the Base, Extras, Updates and CentOSPlus repositories | ||
| # This assumes a fair amount about the structure of the CentOS-Base repo file. | ||
| # Would be nice to use -E "s/^\[(base|updates|extras|centosplus)\]/\[\1_$DIB_CENTOS7_MIRROR_VERSION\]/g" | ||
|
|
||
| sed -e "s|^#baseurl=http[s]*://mirror.centos.org/centos|baseurl=$DIB_CENTOS7_MIRROR|" \ | ||
| -e "/^mirrorlist=/d" \ | ||
| -e "s/^\[base\]/\[base_$DIB_CENTOS7_MIRROR_VERSION\]/g" \ | ||
| -e "s/^\[updates\]/\[updates_$DIB_CENTOS7_MIRROR_VERSION\]/g" \ | ||
| -e "s/^\[extras\]/\[extras_$DIB_CENTOS7_MIRROR_VERSION\]/g" \ | ||
| -e "s/^\[centosplus\]/\[centosplus_$DIB_CENTOS7_MIRROR_VERSION\]/g" \ | ||
| -e "s/\$releasever\>/$DIB_CENTOS7_MIRROR_VERSION/g" /etc/yum.repos.d/CentOS-Base.repo > /etc/yum.repos.d/CentOS-Vault.repo | ||
|
|
||
| yum clean all | ||
| yum-config-manager --disable base updates extras centosplus | ||
| yum-config-manager --enable {base,updates,extras,centosplus}_$DIB_CENTOS7_MIRROR_VERSION | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then | ||
| set -x | ||
| fi | ||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| [ -n "$TARGET_ROOT" ] | ||
|
|
||
| DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-} | ||
|
|
||
| if [ -n "$DIB_LOCAL_IMAGE" ]; then | ||
| # No need to copy a local image into the cache directory, so just specify | ||
| # the cached path as the original path. | ||
| CACHED_IMAGE=$DIB_CENTOS7_CLOUDIMAGE | ||
| else | ||
| CACHED_IMAGE=$DIB_IMAGE_CACHE/$DIB_CENTOS7_CLOUDIMAGE_FILE | ||
| fi | ||
|
|
||
| BASE_IMAGE_TAR=$DIB_CENTOS7_CLOUDIMAGE_FILE.tgz | ||
|
|
||
| $TMP_HOOKS_PATH/bin/extract-image $DIB_CENTOS7_CLOUDIMAGE_FILE $BASE_IMAGE_TAR $DIB_CENTOS7_CLOUDIMAGE $CACHED_IMAGE |
Empty file.
3 changes: 3 additions & 0 deletions
3
elements/centos7-vault/test-elements/build-succeeds/element-deps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| base | ||
| epel | ||
| openstack-ci-mirrors |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the alternative is to include a current version of
CentOS-Vault.repoand update it when there is a new release which you currently need to do anyway due to the switch onDIB_CENTOS7_VERSION.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a CentOS-Vault.repo file published on vault.centos.org? If not I don't think there's a clear advantage that way. This way we can also cope with (eg) internal mirrors or other CentOS repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not directly, but you can get it from the latest centos-release package, e.g: http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-7.1908.0.el7.centos.x86_64.rpm. Like you say though, there probably isn't a massive advantage though.