🚚 Bring over osbuild-composer CI changes
Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
parent
7f249afe07
commit
661e202e79
2 changed files with 42 additions and 15 deletions
16
schutzbot/Jenkinsfile
vendored
16
schutzbot/Jenkinsfile
vendored
|
|
@ -101,7 +101,11 @@ pipeline {
|
||||||
parallel {
|
parallel {
|
||||||
stage('Fedora 31') {
|
stage('Fedora 31') {
|
||||||
agent { label "f31cloudbase && x86_64 && psi" }
|
agent { label "f31cloudbase && x86_64 && psi" }
|
||||||
environment { TEST_TYPE = "image" }
|
environment {
|
||||||
|
TEST_TYPE = "image"
|
||||||
|
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||||
|
DISTRO_CODE = "fedora31"
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
unstash 'fedora31'
|
unstash 'fedora31'
|
||||||
run_tests()
|
run_tests()
|
||||||
|
|
@ -114,7 +118,11 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Fedora 32') {
|
stage('Fedora 32') {
|
||||||
agent { label "f32cloudbase && x86_64 && psi" }
|
agent { label "f32cloudbase && x86_64 && psi" }
|
||||||
environment { TEST_TYPE = "image" }
|
environment {
|
||||||
|
TEST_TYPE = "image"
|
||||||
|
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||||
|
DISTRO_CODE = "fedora32"
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
unstash 'fedora32'
|
unstash 'fedora32'
|
||||||
run_tests()
|
run_tests()
|
||||||
|
|
@ -130,6 +138,8 @@ pipeline {
|
||||||
environment {
|
environment {
|
||||||
TEST_TYPE = "image"
|
TEST_TYPE = "image"
|
||||||
RHN_REGISTRATION_SCRIPT = credentials('rhn-register-script-production')
|
RHN_REGISTRATION_SCRIPT = credentials('rhn-register-script-production')
|
||||||
|
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||||
|
DISTRO_CODE = "rhel8"
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
unstash 'rhel8cdn'
|
unstash 'rhel8cdn'
|
||||||
|
|
@ -146,6 +156,8 @@ pipeline {
|
||||||
environment {
|
environment {
|
||||||
TEST_TYPE = "image"
|
TEST_TYPE = "image"
|
||||||
RHN_REGISTRATION_SCRIPT = credentials('rhn-register-script-production-beta')
|
RHN_REGISTRATION_SCRIPT = credentials('rhn-register-script-production-beta')
|
||||||
|
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||||
|
DISTRO_CODE = "rhel83"
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
unstash 'rhel83'
|
unstash 'rhel83'
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ test_divider () {
|
||||||
get_test_cases () {
|
get_test_cases () {
|
||||||
TEST_CASE_SELECTOR="${ID}_${VERSION_ID%.*}-${ARCH}*.json"
|
TEST_CASE_SELECTOR="${ID}_${VERSION_ID%.*}-${ARCH}*.json"
|
||||||
pushd $IMAGE_TEST_CASES_PATH > /dev/null
|
pushd $IMAGE_TEST_CASES_PATH > /dev/null
|
||||||
ls $TEST_CASE_SELECTOR
|
ls "$TEST_CASE_SELECTOR"
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,19 +29,40 @@ get_test_cases () {
|
||||||
run_test_case () {
|
run_test_case () {
|
||||||
TEST_RUNNER=$1
|
TEST_RUNNER=$1
|
||||||
TEST_CASE_FILENAME=$2
|
TEST_CASE_FILENAME=$2
|
||||||
TEST_NAME=$(basename $TEST_CASE_FILENAME)
|
TEST_NAME=$(basename "$TEST_CASE_FILENAME")
|
||||||
|
|
||||||
echo
|
echo
|
||||||
test_divider
|
test_divider
|
||||||
echo "🏃🏻 Running test: ${TEST_NAME}"
|
echo "🏃🏻 Running test: ${TEST_NAME}"
|
||||||
test_divider
|
test_divider
|
||||||
|
|
||||||
# Set up the testing command.
|
# Set up the testing command with Azure secrets in the environment.
|
||||||
TEST_CMD="$TEST_RUNNER -test.v ${IMAGE_TEST_CASES_PATH}/${TEST_CASE_FILENAME}"
|
#
|
||||||
|
# This works by having a text file stored in Jenkins credentials.
|
||||||
|
# In Jenkinsfile, the following line assigns the path to this secret file
|
||||||
|
# to an environment variable called AZURE_CREDS:
|
||||||
|
# AZURE_CREDS = credentials('azure')
|
||||||
|
#
|
||||||
|
# The file is in the following format:
|
||||||
|
# KEY1=VALUE1
|
||||||
|
# KEY2=VALUE2
|
||||||
|
#
|
||||||
|
# Using `env $(cat $AZURE_CREDS)` we can take all the key-value pairs and
|
||||||
|
# save them as environment variables.
|
||||||
|
# Read test/README.md to see all required environment variables for Azure
|
||||||
|
# uploads
|
||||||
|
#
|
||||||
|
# AZURE_CREDS might not be defined in all cases (e.g. Azure doesn't
|
||||||
|
# support aarch64), therefore the following line sets AZURE_CREDS to
|
||||||
|
# /dev/null if the variable is undefined.
|
||||||
|
AZURE_CREDS=${AZURE_CREDS-/dev/null}
|
||||||
|
OPENSTACK_CREDS=${OPENSTACK_CREDS-/dev/null}
|
||||||
|
VCENTER_CREDS=${VCENTER_CREDS-/dev/null}
|
||||||
|
TEST_CMD="env $(cat "$AZURE_CREDS" "$OPENSTACK_CREDS" "$VCENTER_CREDS") BRANCH_NAME=${BRANCH_NAME-master} BUILD_ID=$BUILD_ID DISTRO_CODE=$DISTRO_CODE $TEST_RUNNER -test.v ${IMAGE_TEST_CASES_PATH}/${TEST_CASE_FILENAME}"
|
||||||
|
|
||||||
# Run the test and add the test name to the list of passed or failed
|
# Run the test and add the test name to the list of passed or failed
|
||||||
# tests depending on the result.
|
# tests depending on the result.
|
||||||
if sudo $TEST_CMD 2>&1 | tee ${WORKSPACE}/${TEST_NAME}.log; then
|
if sudo "$TEST_CMD" 2>&1 | tee "${WORKSPACE}"/"${TEST_NAME}".log; then
|
||||||
PASSED_TESTS+=("$TEST_NAME")
|
PASSED_TESTS+=("$TEST_NAME")
|
||||||
else
|
else
|
||||||
FAILED_TESTS+=("$TEST_NAME")
|
FAILED_TESTS+=("$TEST_NAME")
|
||||||
|
|
@ -61,13 +82,7 @@ cd $WORKING_DIRECTORY
|
||||||
|
|
||||||
# Run each test case.
|
# Run each test case.
|
||||||
for TEST_CASE in $(get_test_cases); do
|
for TEST_CASE in $(get_test_cases); do
|
||||||
# The fedora_32-x86_64-fedora_iot_commit-boot test has some bugs that
|
run_test_case $IMAGE_TEST_CASE_RUNNER "$TEST_CASE"
|
||||||
# still need to be worked out. See this bug for details:
|
|
||||||
# https://github.com/osbuild/osbuild-composer/issues/798
|
|
||||||
if [[ $TEST_CASE == *fedora_iot_commit* ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
run_test_case $IMAGE_TEST_CASE_RUNNER $TEST_CASE
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Print a report of the test results.
|
# Print a report of the test results.
|
||||||
|
|
@ -83,4 +98,4 @@ if [ ${#FAILED_TESTS[@]} -eq 0 ]; then
|
||||||
else
|
else
|
||||||
echo "🔥 One or more tests failed."
|
echo "🔥 One or more tests failed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue