blob: c8ba7455040277fae1f9aabb91f95a1cd912fdd9 [file] [log] [blame]
node ('build') {
stage 'Redeploy CiaB build node'
try {
maasOps: {
sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}"
sh "maas maas machine release ${systemId}"
timeout(time: 15) {
waitUntil {
try {
sh "maas maas machine read ${systemId} | grep Ready"
return true
} catch (exception) {
return false
}
}
}
sh 'maas maas machines allocate'
sh "maas maas machine deploy ${systemId}"
timeout(time: 30) {
waitUntil {
try {
sh "maas maas machine read ${systemId} | grep Deployed"
return true
} catch (exception) {
return false
}
}
}
}
stage 'Wait for SSH on the CiaB build node'
sh 'ssh-keygen -f "/home/ubuntu/.ssh/known_hosts" -R 10.90.0.253'
timeout(time: 15) {
waitUntil {
try {
sh "sshpass -p ${headnodepass} ssh -oStrictHostKeyChecking=no -l ${headnodeuser} 10.90.0.253 curl -o cord-in-a-box.sh https://raw.githubusercontent.com/opencord/cord/master/scripts/cord-in-a-box.sh"
return true
} catch (exception) {
return false
}
}
}
stage 'Run CORD-in-a-Box script'
sh "sshpass -p ${headnodepass} ssh -oStrictHostKeyChecking=no -l ${headnodeuser} 10.90.0.253 bash cord-in-a-box.sh -t"
currentBuild.result = 'SUCCESS'
} catch (err) {
currentBuild.result = 'FAILURE'
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'cord-dev@opencord.org', sendToIndividuals: false])
} finally {
}
echo "RESULT: ${currentBuild.result}"
}