tests: Define COMPOSE_URL/COMPOSE_ID in a single place. Fix #1397

we don't want this defined multiple times in different places
This commit is contained in:
Alexander Todorov 2021-05-11 13:30:03 +03:00 committed by Ondřej Budai
parent cca084d5ce
commit 57cebbfaea
4 changed files with 15 additions and 11 deletions

View file

@ -191,6 +191,7 @@ install -m 0755 -vp _bin/osbuild-image-tests %{buildroot}%{_l
install -m 0755 -vp _bin/osbuild-auth-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp _bin/osbuild-koji-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp _bin/cloud-cleaner %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/define-compose-url.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/provision.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/gen-certs.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/image-info %{buildroot}%{_libexecdir}/osbuild-composer-test/

View file

@ -8,16 +8,7 @@ function greenprint {
ARCH=$(uname -m)
curl -L http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/latest-RHEL-8.4/COMPOSE_ID > COMPOSE_ID
COMPOSE_ID=$(cat COMPOSE_ID)
# default to a nightly tree but respect values passed from ENV so we can test rel-eng
# composes as well
COMPOSE_URL="${COMPOSE_URL:-http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/$COMPOSE_ID}"
# in case COMPOSE_URL was defined from the outside refresh COMPOSE_ID file,
# used for telegram messages in case of success/failure
curl -L "$COMPOSE_URL/COMPOSE_ID" > COMPOSE_ID
source ../tools/define-compose-url.sh
# Create a repository file for installing the osbuild-composer RPMs
greenprint "📜 Generating dnf repository file"

View file

@ -2,6 +2,7 @@
set -euo pipefail
OSBUILD_COMPOSER_TEST_DATA=/usr/share/tests/osbuild-composer/
source /usr/libexec/osbuild-composer-test/define-compose-url.sh
# Get OS data.
source /etc/os-release
@ -31,7 +32,6 @@ case "${ID}-${VERSION_ID}" in
IMAGE_TYPE=rhel-edge-commit
OSTREE_REF="rhel/8/${ARCH}/edge"
OS_VARIANT="rhel8-unknown"
COMPOSE_URL="${COMPOSE_URL:-http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/latest-RHEL-8.4}"
BOOT_LOCATION="$COMPOSE_URL/compose/BaseOS/x86_64/os/";;
*)
echo "unsupported distro: ${ID}-${VERSION_ID}"

12
tools/define-compose-url.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail
curl -L http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/latest-RHEL-8.4/COMPOSE_ID > COMPOSE_ID
COMPOSE_ID=$(cat COMPOSE_ID)
# default to a nightly tree but respect values passed from ENV so we can test rel-eng composes as well
COMPOSE_URL="${COMPOSE_URL:-http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/$COMPOSE_ID}"
# in case COMPOSE_URL was defined from the outside refresh COMPOSE_ID file,
# used for telegram messages in case of success/failure
curl -L "$COMPOSE_URL/COMPOSE_ID" > COMPOSE_ID