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

@ -8,6 +8,7 @@ stages:
after_script:
- schutzbot/update_github_status.sh update
- schutzbot/save_journal.sh
- schutzbot/run_cloud_cleaner.sh
tags:
- terraform
artifacts:
@ -81,6 +82,34 @@ OSTree:
- openstack/fedora-33-x86_64
- openstack/rhel-8-x86_64
Integration:
stage: test
extends: .terraform
variables:
EXTRA_REPO_PATH_SEGMENT: "gitlab/"
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/koji.sh
- /usr/libexec/tests/osbuild-composer/libvirt.sh
- /usr/libexec/tests/osbuild-composer/aws.sh
- /usr/libexec/tests/osbuild-composer/azure.sh
- /usr/libexec/tests/osbuild-composer/api.sh azure
- /usr/libexec/tests/osbuild-composer/api.sh aws
parallel:
matrix:
- RUNNER:
- aws/fedora-32-x86_64
- aws/fedora-33-x86_64
- aws/centos-stream-8-x86_64
- RUNNER:
- aws/rhel-8-x86_64
- aws/rhel-8.4-x86_64
INTERNAL_NETWORK: ["true"]
- RUNNER:
- aws/rhel-8-x86_64
INTERNAL_NETWORK: ["true"]
DISTRO_CODE: ["rhel_90"]
finish:
stage: finish
tags:

60
schutzbot/Jenkinsfile vendored
View file

@ -815,34 +815,41 @@ void run_tests(test_type) {
if (test_type == 'integration') {
// Run Koji tests.
sh (
label: "Koji tests",
script: "/usr/libexec/tests/osbuild-composer/koji.sh"
)
if (env.BUILD_CAUSE == 'cron') {
sh (
label: "Koji tests",
script: "/usr/libexec/tests/osbuild-composer/koji.sh"
)
// Run the libvirt test.
sh (
label: "Integration test: libvirt",
script: "/usr/libexec/tests/osbuild-composer/libvirt.sh"
)
// Run the libvirt test.
sh (
label: "Integration test: libvirt",
script: "/usr/libexec/tests/osbuild-composer/libvirt.sh"
)
// Run the AWS test.
sh (
label: "Integration test: AWS",
script: "/usr/libexec/tests/osbuild-composer/aws.sh"
)
// Run the AWS test.
sh (
label: "Integration test: AWS",
script: "/usr/libexec/tests/osbuild-composer/aws.sh"
)
// Run the Azure test.
sh (
label: "Integration test: AZURE",
script: "/usr/libexec/tests/osbuild-composer/azure.sh"
)
// Run the Azure test.
sh (
label: "Integration test: AZURE",
script: "/usr/libexec/tests/osbuild-composer/azure.sh"
)
// Run the API test with AWS.
sh (
label: "Integration test: API (AWS)",
script: "/usr/libexec/tests/osbuild-composer/api.sh aws"
)
// Run the API test with AWS.
sh (
label: "Integration test: API (AWS)",
script: "/usr/libexec/tests/osbuild-composer/api.sh aws"
)
sh (
label: "Integration test: API (Azure)",
script: "/usr/libexec/tests/osbuild-composer/api.sh azure"
)
}
if (env.GOOGLE_APPLICATION_CREDENTIALS) {
// Run the API test with GCP.
@ -852,11 +859,6 @@ void run_tests(test_type) {
)
}
sh (
label: "Integration test: API (Azure)",
script: "/usr/libexec/tests/osbuild-composer/api.sh azure"
)
if (env.VCENTER_CREDS) {
// Run the VMWare test.
sh (

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}}"
CLEANER_CMD="env $(cat "${AZURE_CREDS:-/dev/null}") BRANCH_NAME=$BRANCH_NAME BUILD_ID=$BUILD_ID DISTRO_CODE=$DISTRO_CODE /usr/libexec/osbuild-composer-test/cloud-cleaner"

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 {

View file

@ -303,6 +303,7 @@ for LOOP_COUNTER in $(seq 0 ${MAX_LOOPS}); do
echo "Smoke test passed! 🥳"
break
fi
echo "Machine is not ready yet, retrying connection."
sleep 10
done