Jenkinsfile for nightly CORD-in-a-Box build
Change-Id: Ic439f67a2d9efcf4b77abf7b5c0a082504ee3940
diff --git a/Jenkinsfile.ciab b/Jenkinsfile.ciab
new file mode 100644
index 0000000..c8ba745
--- /dev/null
+++ b/Jenkinsfile.ciab
@@ -0,0 +1,58 @@
+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}"
+}