Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from RedHat-MultiArch-QE/dev-v1.1.0
Browse files Browse the repository at this point in the history
Release v1.1.0
  • Loading branch information
jaypoulz authored Mar 5, 2019
2 parents fb427da + 30a05a4 commit 8d97f59
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 39 deletions.
114 changes: 84 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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\'',
selector: 'name = \'ansible\' AND type = \'Tag\' AND tag LIKE \'ansible-%-rhel-%-candidate\'',
timeout: null
]
]
Expand All @@ -31,7 +31,7 @@ properties(
name: 'LIBRARIES_REPO'
),
string(
defaultValue: 'v1.2.1',
defaultValue: 'v1.2.2',
description: 'Git reference to the branch or tag of shared libraries.',
name: 'LIBRARIES_REF'
),
Expand Down Expand Up @@ -60,6 +60,16 @@ properties(
description: 'Build task ID for which to run the pipeline',
name: 'TASK_ID'
),
string(
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; mclay',
description: 'Semi-colon delimited list of email notification recipients.',
Expand All @@ -76,15 +86,82 @@ 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'

MAQEAPI.v1.runParallelMultiArchTest(
// 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.runTest(
this,
arches,
targetHosts,
config,
{ host ->
/*********************************************************/
Expand All @@ -101,20 +178,12 @@ MAQEAPI.v1.runParallelMultiArchTest(
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")) {
Expand All @@ -129,26 +198,11 @@ 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

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',
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/example-test/test.sh

This file was deleted.

1 change: 0 additions & 1 deletion tests/scripts/example-test2/test.sh

This file was deleted.

9 changes: 2 additions & 7 deletions tests/scripts/rhel-system-roles/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 8d97f59

Please sign in to comment.