From f5633d702cf189e473aa8e5371bed24dd64ee037 Mon Sep 17 00:00:00 2001 From: Jeremy Poulin Date: Mon, 17 Dec 2018 10:47:38 -0500 Subject: [PATCH 1/4] Adding nvr lookup to results Removed nvr if it doesn't exist Removed sudo Fixed bad substitution Added more prereqs for install Removing the global disable since it prevents ansible from installing properly. Don't run these tests unless the target is RHEL7 Encountered an issue where you don't know which OS to install until you install brew Updated Ansible Engine test to lookup build info before attempting to provision hosts Adding new UUID Fixing closure syntax Escaping $ Fixed distro ternary Attempting to parse message within node step Initializing message to map Cleaning up script Removing the newline from brew lookup Underscores for constants/param strings Pushing the created target hosts Debugging why arch is coming up as a string ref Converted debug big into a string Updating to runTest method so TargetHosts will be interpretted correctly Disabling JNLP mode for RHEL-8 support Updating to dev libs Cleaned up dead tests and remove epel disable Limited scope since machines are down Added inventory file override for ansible_python_interpret on rhel-8 hosts Fixed variable name Removed debugging log and renamed output --- Jenkinsfile | 115 ++++++++++++++++++------ tests/scripts/example-test/test.sh | 1 - tests/scripts/example-test2/test.sh | 1 - tests/scripts/rhel-system-roles/test.sh | 9 +- 4 files changed, 91 insertions(+), 35 deletions(-) delete mode 100644 tests/scripts/example-test/test.sh delete mode 100644 tests/scripts/example-test2/test.sh diff --git a/Jenkinsfile b/Jenkinsfile index 13eea5e..3e72b29 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,8 +9,8 @@ properties( [ $class: 'ActiveMQSubscriberProviderData', name: 'Red Hat UMB', - overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.f88e907e-04c5-11e9-8eb2-f2801f1b9fd1.VirtualTopic.eng.brew.>'], - selector: 'name = \'ansible\' AND type = \'Tag\' AND tag LIKE \'ansible-%-rhel-7-candidate\'', + overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.a3d96a6e-b99e-43c1-b11d-a996e18a1b2d.VirtualTopic.eng.brew.>'], + selector: 'name = \'ansible\' AND type = \'Tag\' AND tag LIKE \'ansible-%-rhel-%-candidate\'', timeout: null ] ] @@ -19,19 +19,19 @@ properties( parameters( [ [$class: 'ValidatingStringParameterDefinition', - defaultValue: 'x86_64,ppc64le', + defaultValue: 'x86_64', description: 'A comma separated list of architectures to run the test on. Valid values include [x86_64, ppc64le, aarch64, s390x].', failedValidationMessage: 'Invalid architecture. Valid values are [x86_64, ppc64le, aarch64, s390x].', name: 'ARCHES', regex: '^(?:x86_64|ppc64le|aarch64|s390x)(?:,\\s*(?:x86_64|ppc64le|aarch64|s390x))*$' ], string( - defaultValue: 'https://github.com/redhat-multiarch-qe/multiarch-ci-libraries', + defaultValue: 'https://github.com/jaypoulz/multiarch-ci-libraries', description: 'Repo for shared libraries.', name: 'LIBRARIES_REPO' ), string( - defaultValue: 'v1.2.1', + defaultValue: 'dev-v1.2.2', description: 'Git reference to the branch or tag of shared libraries.', name: 'LIBRARIES_REF' ), @@ -56,12 +56,22 @@ properties( name: 'CI_MESSAGE' ), string( - defaultValue: '18574111', + defaultValue: '19572674', description: 'Build task ID for which to run the pipeline', name: 'TASK_ID' ), string( - defaultValue: 'jpoulin; mclay', + defaultValue: 'RHEL-ALT-7.5', + description: 'RHEL 7 distribution.', + name: 'RHEL7_DISTRO' + ), + string( + defaultValue: 'RHEL-8.0.0-20190129.1', + description: 'RHEL 8 distribution.', + name: 'RHEL8_DISTRO' + ), + string( + defaultValue: 'jpoulin', description: 'Semi-colon delimited list of email notification recipients.', name: 'EMAIL_SUBSCRIBERS' ) @@ -76,15 +86,83 @@ library( retriever: modernSCM([$class: 'GitSCMSource',remote: "${params.LIBRARIES_REPO}"]) ) -List arches = params.ARCHES.tokenize(',') +// MACIT configuration def errorMessages = '' def config = MAQEAPI.v1.getProvisioningConfig(this) config.installRhpkg = true -config.mode = 'JNLP' +//config.mode = 'JNLP' + +// Get build information +Map message = [:] +String taskId = '' +String nvr = '' + +// Required host information +List arches = params.ARCHES.tokenize(',') +String os = '' +String distro = '' +String variant = '' + +// Lookup the build information +MAQEAPI.v1.testWrapper(this, config) { + node ("provisioner-${config.version}"){ + // Message + message = getCIMessage(params.CI_MESSAGE) + + // Task ID + taskId = message && message.build && message.build.task_id ?: params.TASK_ID + if (!taskId) { + error("Invalid brew task ID for CI_MESSAGE: ${params.CI_MESSAGE} and TASK_ID: ${params.TASK_ID}.") + } + + // NVR + nvr = sh(script:"brew taskinfo ${taskId} | grep 'Build:' | cut -d' ' -f2", returnStdout:true) + if (!nvr) { + error("Invalid nvr: ${nvr}.") + } + + // OS + os = sh( + script: """ + brew buildinfo \ + \$(brew taskinfo ${taskId} | grep 'Build:' | cut -d '(' -f 2 | cut -d ')' -f 1) | \ + grep 'Volume:' | cut -d ' ' -f 2 + """, + returnStdout: true + ).trim() + if (!os || !(['rhel-7', 'rhel-8'].contains(os))) { + error("Invalid OS version: ${os}.") + } + + // Distro + distro = (os == 'rhel-8') ? params.RHEL8_DISTRO : params.RHEL7_DISTRO + if (!distro) { + error("Invalid distro: ${distro}.") + } + + // Variant + variant = (os == 'rhel-8') ? 'BaseOS' : 'Server' + if (!variant) { + error("Invalid variant: ${variant}.") + } + } +} + +def targetHosts = [] +for (String arch in arches) { + def targetHost = MAQEAPI.v1.newTargetHost() + targetHost.arch = arch + targetHost.distro = distro + targetHost.variant = variant + if (os == 'rhel-8') { + targetHost.inventoryVars = [ ansible_python_interpreter:'/usr/libexec/platform-python' ] + } + targetHosts.push(targetHost) +} -MAQEAPI.v1.runParallelMultiArchTest( +MAQEAPI.v1.runTest( this, - arches, + targetHosts, config, { host -> /*********************************************************/ @@ -129,21 +207,6 @@ MAQEAPI.v1.runParallelMultiArchTest( errorMessages += "Exception ${e} occured while unarchiving artifacts\n" } - String nvr = '' - if (params.CI_MESSAGE) { - final String CI_MESSAGE_FILE = 'message.json' - writeFile(file:CI_MESSAGE_FILE, text:params.CI_MESSAGE) - Map json = readJSON(file:CI_MESSAGE_FILE) - nvr = json['build'].nvr - } else { - sh(''' - yum install -y yum-utils; - yum-config-manager --add-repo http://download.devel.redhat.com/rel-eng/RCMTOOLS/rcm-tools-rhel-7-server.repo; - yum install -y koji brewkoji - ''') - nvr = sh(script:"brew taskinfo ${params.TASK_ID} | grep 'Build:' | cut -d' ' -f2", returnStdout:true) - } - def emailBody = "Results for ${env.JOB_NAME} - Build #${currentBuild.number}\n\nResult: ${currentBuild.currentResult}\nNVR: ${nvr}\nURL: $BUILD_URL" if (errorMessages) emailBody += "\nErrors: " + errorMessages diff --git a/tests/scripts/example-test/test.sh b/tests/scripts/example-test/test.sh deleted file mode 100644 index 9b42239..0000000 --- a/tests/scripts/example-test/test.sh +++ /dev/null @@ -1 +0,0 @@ -echo "This is a shell script test" diff --git a/tests/scripts/example-test2/test.sh b/tests/scripts/example-test2/test.sh deleted file mode 100644 index 95290cf..0000000 --- a/tests/scripts/example-test2/test.sh +++ /dev/null @@ -1 +0,0 @@ -echo "This test should run too" diff --git a/tests/scripts/rhel-system-roles/test.sh b/tests/scripts/rhel-system-roles/test.sh index 777f93a..31586cc 100644 --- a/tests/scripts/rhel-system-roles/test.sh +++ b/tests/scripts/rhel-system-roles/test.sh @@ -2,19 +2,14 @@ # # Attempts to clone down the test package and run it -# Ensure Ansible gets installed from task repo -sudo yum remove ansible -y -sudo yum install ansible -y --disablerepo epel -sudo yum-config-manager --save --setopt epel.exclude=ansible* - cd "$(dirname ${BASH_SOURCE[0]})" workdir=$(pwd) rhpkg --verbose --user=jenkins clone tests/rhel-system-roles cd rhel-system-roles git checkout CoreOS-rhel-system-roles-Sanity-Upstream-testsuite-multiarch-ci-1_1-1 cd Sanity/Upstream-testsuite-multiarch-ci -output_dir="$workdir/artifacts/rhel-system-roles" -output_file="$output_dir/$(arch).txt" +output_dir="$workdir/artifacts/rhel-system-roles/results" +output_file="$output_dir/$(arch)-test-output.txt" mkdir -p $output_dir sudo make &> $output_file run grep "OVERALL RESULT" $output_file | grep "PASS" From 90470aab4dde1127cbca9e862e8592efbf7297b6 Mon Sep 17 00:00:00 2001 From: Jeremy Poulin Date: Mon, 25 Feb 2019 13:30:34 -0500 Subject: [PATCH 2/4] Reconfigured email output for test, and repointed to released libs --- Jenkinsfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e72b29..ecf67a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,19 +19,19 @@ properties( parameters( [ [$class: 'ValidatingStringParameterDefinition', - defaultValue: 'x86_64', + defaultValue: 'x86_64,ppc64le', description: 'A comma separated list of architectures to run the test on. Valid values include [x86_64, ppc64le, aarch64, s390x].', failedValidationMessage: 'Invalid architecture. Valid values are [x86_64, ppc64le, aarch64, s390x].', name: 'ARCHES', regex: '^(?:x86_64|ppc64le|aarch64|s390x)(?:,\\s*(?:x86_64|ppc64le|aarch64|s390x))*$' ], string( - defaultValue: 'https://github.com/jaypoulz/multiarch-ci-libraries', + defaultValue: 'https://github.com/redhat-multiarch-qe/multiarch-ci-libraries', description: 'Repo for shared libraries.', name: 'LIBRARIES_REPO' ), string( - defaultValue: 'dev-v1.2.2', + defaultValue: 'v1.2.2', description: 'Git reference to the branch or tag of shared libraries.', name: 'LIBRARIES_REF' ), @@ -90,7 +90,6 @@ library( def errorMessages = '' def config = MAQEAPI.v1.getProvisioningConfig(this) config.installRhpkg = true -//config.mode = 'JNLP' // Get build information Map message = [:] @@ -211,7 +210,7 @@ MAQEAPI.v1.runTest( if (errorMessages) emailBody += "\nErrors: " + errorMessages emailext( - subject: "${env.JOB_NAME} (#${currentBuild.number}) - ${nvr ? nvr + ' - ': ''}${currentBuild.currentResult}", + subject: "${nvr ? nvr + ' - ': ''}${currentBuild.currentResult} - ${env.JOB_NAME} (#${currentBuild.number})", body: emailBody, from: 'multiarch-qe-jenkins', replyTo: 'multiarch-qe', From 08f4537fb5b9172912de13743cc269739f739cca Mon Sep 17 00:00:00 2001 From: Jeremy Poulin Date: Thu, 28 Feb 2019 13:11:25 -0500 Subject: [PATCH 3/4] Reconverted defaults for release v1.1.0 --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ecf67a2..bb8a491 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ properties( [ $class: 'ActiveMQSubscriberProviderData', name: 'Red Hat UMB', - overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.a3d96a6e-b99e-43c1-b11d-a996e18a1b2d.VirtualTopic.eng.brew.>'], + overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.f88e907e-04c5-11e9-8eb2-f2801f1b9fd1.VirtualTopic.eng.brew.>'], selector: 'name = \'ansible\' AND type = \'Tag\' AND tag LIKE \'ansible-%-rhel-%-candidate\'', timeout: null ] @@ -56,7 +56,7 @@ properties( name: 'CI_MESSAGE' ), string( - defaultValue: '19572674', + defaultValue: '18574111', description: 'Build task ID for which to run the pipeline', name: 'TASK_ID' ), @@ -71,7 +71,7 @@ properties( name: 'RHEL8_DISTRO' ), string( - defaultValue: 'jpoulin', + defaultValue: 'jpoulin; mclay', description: 'Semi-colon delimited list of email notification recipients.', name: 'EMAIL_SUBSCRIBERS' ) From 30a05a4315ca26f61eba1f790bc854c9c95d1416 Mon Sep 17 00:00:00 2001 From: Jeremy Poulin Date: Thu, 28 Feb 2019 13:41:56 -0500 Subject: [PATCH 4/4] Removing explicit archiving since that's baked into MACIT Libs v1.2.2 --- Jenkinsfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bb8a491..0476b36 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -178,20 +178,12 @@ MAQEAPI.v1.runTest( runTests(config, host) } - stage ('Archive Test Output') { - archiveOutput() - } - /*****************************************************************/ /* END TEST BODY */ /* Do not edit beyond this point */ /*****************************************************************/ }, { Exception exception, def host -> - stage ('Archive Failed Test Output') { - archiveOutput() - } - def error = "Exception ${exception} occured on ${host.arch}\n" errorMessages += error if (host.arch.equals("x86_64") || host.arch.equals("ppc64le")) {