tests: move some integration tests to gitlab CI

This also includes several modifications to tests scripts to
enable them running in gitlab CI.
This commit is contained in:
Jakub Rusz 2021-05-04 18:15:09 +02:00 committed by Alexander Todorov
parent e613b2456b
commit 8dcf859473
7 changed files with 84 additions and 36 deletions

View file

@ -130,7 +130,7 @@ function cleanupAzure() {
# do not run clean-up if the image name is not yet defined
if [[ -n "$AZURE_CMD" && -n "$AZURE_IMAGE_NAME" ]]; then
set +e
$AZURE_CMD image delete --resource-group sharing-research --name "$AZURE_IMAGE_NAME"
$AZURE_CMD image delete --resource-group "$AZURE_RESOURCE_GROUP" --name "$AZURE_IMAGE_NAME"
# find a storage account by its tag
AZURE_STORAGE_ACCOUNT=$($AZURE_CMD resource list --tag imageBuilderStorageAccount=location="$AZURE_LOCATION" | jq -r .[0].name)

View file

@ -3,6 +3,8 @@ set -euo pipefail
source /etc/os-release
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
BRANCH_NAME="${BRANCH_NAME:-${CI_COMMIT_BRANCH}}"
BUILD_ID="${BUILD_ID:-${CI_PIPELINE_ID}}"
# Colorful output.
function greenprint {
@ -102,11 +104,16 @@ get_compose_metadata () {
cat "${COMPOSE_ID}".json | jq -M '.' | tee "$METADATA_FILE" > /dev/null
}
# Export Azure credentials
exec 4<"$AZURE_CREDS"
readarray -t -u 4 vars
for line in "${vars[@]}"; do export "${line?}"; done
exec 4<&-
# Export Azure credentials if running on Jenkins
set +u
if [ -n "$AZURE_CREDS" ]
then
exec 4<"$AZURE_CREDS"
readarray -t -u 4 vars
for line in "${vars[@]}"; do export "${line?}"; done
exec 4<&-
fi
set -u
# Write an Azure TOML file
tee "$AZURE_CONFIG" > /dev/null << EOF

View file

@ -6,7 +6,14 @@ OSBUILD_COMPOSER_TEST_DATA=/usr/share/tests/osbuild-composer/
# Get OS data.
source /etc/os-release
ARCH=$(uname -m)
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
# This should be revisited and solved in a more sustainable way
if [[ "$ID" == 'rhel' ]] && [[ "$VERSION_ID" == 8.3 ]]
then
DISTRO_CODE="${DISTRO_CODE:-rhel_8}"
else
DISTRO_CODE="${DISTRO_CODE:-${ID}_${VERSION_ID//./}}"
fi
# Colorful output.
function greenprint {