|
Pierre-Yves Chibon |
d637dc |
def onmyduffynode(script){
|
|
Pierre-Yves Chibon |
d637dc |
ansiColor('xterm'){
|
|
Pierre-Yves Chibon |
d637dc |
timestamps{
|
|
Brian Stinson |
f850c4 |
sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t REPO=${REPO} BRANCH=${BRANCH} "' + script + '"'
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Pierre-Yves Chibon |
d637dc |
def syncfromduffynode(rsyncpath){
|
|
Pierre-Yves Chibon |
d637dc |
sh 'rsync -e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root " -Ha --include=' + rsyncpath + " ${DUFFY_NODE}.ci.centos.org:~/ ./"
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Pierre-Yves Chibon |
d637dc |
node('pagure') {
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Brian Stinson |
f850c4 |
properties([
|
|
Brian Stinson |
f850c4 |
parameters([
|
|
Brian Stinson |
f850c4 |
string(defaultValue: "", description: "", name: "REPO"),
|
|
Brian Stinson |
f850c4 |
string(defaultValue: "", description: "", name: "BRANCH"),
|
|
Brian Stinson |
f850c4 |
])
|
|
Brian Stinson |
f850c4 |
])
|
|
Brian Stinson |
f850c4 |
|
|
Pierre-Yves Chibon |
d637dc |
stage('Allocate Node'){
|
|
Pierre-Yves Chibon |
d637dc |
env.CICO_API_KEY = readFile("${env.HOME}/duffy.key").trim()
|
|
Pierre-Yves Chibon |
d637dc |
duffy_rtn=sh(
|
|
Pierre-Yves Chibon |
d637dc |
script: 'cico --debug node get -f value -c hostname -c comment',
|
|
Pierre-Yves Chibon |
d637dc |
returnStdout: true
|
|
Pierre-Yves Chibon |
d637dc |
).trim().tokenize(' ')
|
|
Pierre-Yves Chibon |
d637dc |
env.DUFFY_NODE=duffy_rtn[0]
|
|
Pierre-Yves Chibon |
d637dc |
env.SSID=duffy_rtn[1]
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Pierre-Yves Chibon |
d637dc |
try {
|
|
Pierre-Yves Chibon |
d637dc |
stage('Pre Setup Node'){
|
|
Pierre-Yves Chibon |
d637dc |
// Install EPEL
|
|
Pierre-Yves Chibon |
e18a1b |
onmyduffynode 'yum -y install epel-release git'
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Pierre-Yves Chibon |
d637dc |
stage('Clone Test Suite') {
|
|
Brian Stinson |
d17173 |
if (env.BRANCH_NAME){
|
|
Brian Stinson |
d17173 |
onmyduffynode "git clone -b \"${env.BRANCH_NAME}\" --single-branch --depth 1 https://pagure.io/pagure.git"
|
|
Brian Stinson |
d17173 |
} else {
|
|
Brian Stinson |
d17173 |
onmyduffynode "git clone --single-branch --depth 1 https://pagure.io/pagure.git"
|
|
Brian Stinson |
d17173 |
}
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Pierre-Yves Chibon |
d637dc |
stage('Run Test Suite') {
|
|
Pierre-Yves Chibon |
e18a1b |
timeout(time: 6, unit: 'HOURS') {
|
|
Pierre-Yves Chibon |
d637dc |
onmyduffynode 'cd pagure && sh ./run_ci_tests.sh'
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
|
|
Pierre-Yves Chibon |
d637dc |
} catch (e) {
|
|
Pierre-Yves Chibon |
d637dc |
currentBuild.result = "FAILED"
|
|
Pierre-Yves Chibon |
d637dc |
throw e
|
|
Pierre-Yves Chibon |
d637dc |
} finally {
|
|
Brian Stinson |
62de45 |
stage('Sync Artifacts'){
|
|
Brian Stinson |
62de45 |
syncfromduffynode('pagure/*.out')
|
|
Brian Stinson |
62de45 |
}
|
|
Brian Stinson |
62de45 |
|
|
Pierre-Yves Chibon |
d637dc |
stage('Deallocate Node'){
|
|
Pierre-Yves Chibon |
d637dc |
sh 'cico node done ${SSID}'
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Brian Stinson |
62de45 |
|
|
Brian Stinson |
62de45 |
stage('Archive Artifacts'){
|
|
Brian Stinson |
62de45 |
archiveArtifacts artifacts: '*.out'
|
|
Brian Stinson |
62de45 |
}
|
|
Pierre-Yves Chibon |
d637dc |
}
|
|
Pierre-Yves Chibon |
d637dc |
}
|