test: move env variables into set-env-variables helper

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-07-09 12:01:29 +02:00 committed by Ondřej Budai
parent f3a58d699a
commit 4c5d1ae45a
18 changed files with 24 additions and 30 deletions

View file

@ -234,6 +234,7 @@ install -m 0755 -vp tools/image-info %{buildroot}%{_l
install -m 0755 -vp tools/run-koji-container.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/koji-compose.py %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/libvirt_test.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vp tools/set-env-variables.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/
install -m 0755 -vd %{buildroot}%{_libexecdir}/tests/osbuild-composer
install -m 0755 -vp test/cases/* %{buildroot}%{_libexecdir}/tests/osbuild-composer/

View file

@ -51,8 +51,7 @@ EOF
}
# Get OS details.
source /etc/os-release
ARCH=$(uname -m)
source tools/set-env-variables.sh
if [[ $ID == "rhel" && ${VERSION_ID%.*} == "9" ]]; then
# There's a bug in RHEL 9 that causes /tmp to be mounted on tmpfs.

View file

@ -7,8 +7,7 @@ function greenprint {
}
# Get OS and architecture details.
source /etc/os-release
ARCH=$(uname -m)
source tools/set-env-variables.sh
# Register RHEL if we are provided with a registration script.
if [[ $ID == "rhel" && $VERSION_ID == "8.3" && -n "${RHN_REGISTRATION_SCRIPT:-}" ]] && ! sudo subscription-manager status; then

View file

@ -1,8 +1,7 @@
#!/bin/bash
set -euo pipefail
source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
source tools/set-env-variables.sh
BRANCH_NAME="${BRANCH_NAME:-${CI_COMMIT_BRANCH}}"
BUILD_ID="${BUILD_ID:-${CI_BUILD_ID}}"

View file

@ -17,8 +17,7 @@ set -euxo pipefail
ARTIFACTS=ci-artifacts
mkdir -p "${ARTIFACTS}"
source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Container image used for cloud provider CLI tools
CONTAINER_IMAGE_CLOUD_TOOLS="quay.io/osbuild/cloud-tools:latest"

View file

@ -1,8 +1,7 @@
#!/bin/bash
set -euo pipefail
source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Colorful output.
function greenprint {

View file

@ -2,8 +2,7 @@
shopt -s expand_aliases
set -euo pipefail
source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
BRANCH_NAME="${CI_COMMIT_BRANCH:-local}"
BUILD_ID="${CI_BUILD_ID:-$(uuidgen)}"
HYPER_V_GEN="${HYPER_V_GEN:-V1}"

View file

@ -2,9 +2,7 @@
set -euo pipefail
# Get OS and architecture details.
source /etc/os-release
ARCH=$(uname -m)
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
if [[ -n "$CI_BUILD_ID" ]]; then
BUILD_ID="${BUILD_ID:-${CI_BUILD_ID}}"

View file

@ -5,7 +5,7 @@ set -euo pipefail
/usr/libexec/osbuild-composer-test/provision.sh
# Get OS data.
source /etc/os-release
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Colorful output.
function greenprint {

View file

@ -4,8 +4,7 @@ set -euo pipefail
OSBUILD_COMPOSER_TEST_DATA=/usr/share/tests/osbuild-composer/
# Get OS data.
source /etc/os-release
ARCH=$(uname -m)
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Colorful output.
function greenprint {

View file

@ -2,8 +2,7 @@
set -euo pipefail
# Get OS data.
source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Provision the software under test.
/usr/libexec/osbuild-composer-test/provision.sh

View file

@ -5,8 +5,7 @@ set -euo pipefail
/usr/libexec/osbuild-composer-test/provision.sh
# Get OS data.
source /etc/os-release
ARCH=$(uname -m)
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Colorful output.
function greenprint {

View file

@ -4,8 +4,7 @@ set -euo pipefail
source /usr/libexec/osbuild-composer-test/define-compose-url.sh
# Get OS data.
source /etc/os-release
ARCH=$(uname -m)
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Provision the software under test.
/usr/libexec/osbuild-composer-test/provision.sh

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
source /etc/os-release
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
TESTS_PATH=/usr/libexec/tests/osbuild-composer/
mkdir --parents /tmp/logs

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
source /etc/os-release
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Colorful output.
function greenprint {

View file

@ -4,8 +4,7 @@ set -euo pipefail
OSBUILD_COMPOSER_TEST_DATA=/usr/share/tests/osbuild-composer/
# Get OS data.
source /etc/os-release
ARCH=$(uname -m)
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# Take the image type passed to the script or use qcow2 by default if nothing
# was passed.

View file

@ -1,8 +1,7 @@
#!/bin/bash
set -euxo pipefail
source /etc/os-release
ARCH=$(uname -m)
source /usr/libexec/osbuild-composer-test/set-env-variables.sh
# koji and ansible are not in RHEL repositories. Depending on them in the spec
# file breaks RHEL gating (see OSCI-1541). Therefore, we need to enable epel

View file

@ -0,0 +1,7 @@
#!/bin/bash
# don't error on unused ARCH and DISTRO_CODE variables
# shellcheck disable=SC2034
source /etc/os-release
ARCH=$(uname -m)
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"