From 57cebbfaeabcb4a686a335e3b6ea59e7ce6701f4 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Tue, 11 May 2021 13:30:03 +0300 Subject: [PATCH] tests: Define COMPOSE_URL/COMPOSE_ID in a single place. Fix #1397 we don't want this defined multiple times in different places --- osbuild-composer.spec | 1 + schutzbot/prepare-rhel-internal.sh | 11 +---------- test/cases/ostree.sh | 2 +- tools/define-compose-url.sh | 12 ++++++++++++ 4 files changed, 15 insertions(+), 11 deletions(-) create mode 100755 tools/define-compose-url.sh diff --git a/osbuild-composer.spec b/osbuild-composer.spec index a9e5cd132..248477d03 100644 --- a/osbuild-composer.spec +++ b/osbuild-composer.spec @@ -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/ diff --git a/schutzbot/prepare-rhel-internal.sh b/schutzbot/prepare-rhel-internal.sh index 376a0c3ae..e286c49b5 100755 --- a/schutzbot/prepare-rhel-internal.sh +++ b/schutzbot/prepare-rhel-internal.sh @@ -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" diff --git a/test/cases/ostree.sh b/test/cases/ostree.sh index 6edb48738..228760c1d 100755 --- a/test/cases/ostree.sh +++ b/test/cases/ostree.sh @@ -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}" diff --git a/tools/define-compose-url.sh b/tools/define-compose-url.sh new file mode 100755 index 000000000..686172617 --- /dev/null +++ b/tools/define-compose-url.sh @@ -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