Andy Bavier | a804927 | 2016-11-21 14:52:21 -0500 | [diff] [blame] | 1 | node ('build') { |
| 2 | stage 'Redeploy CiaB build node' |
| 3 | try { |
| 4 | maasOps: { |
| 5 | sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}" |
| 6 | sh "maas maas machine release ${systemId}" |
| 7 | |
| 8 | timeout(time: 15) { |
| 9 | waitUntil { |
| 10 | try { |
| 11 | sh "maas maas machine read ${systemId} | grep Ready" |
| 12 | return true |
| 13 | } catch (exception) { |
| 14 | return false |
| 15 | } |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | sh 'maas maas machines allocate' |
| 20 | sh "maas maas machine deploy ${systemId}" |
| 21 | |
| 22 | timeout(time: 30) { |
| 23 | waitUntil { |
| 24 | try { |
| 25 | sh "maas maas machine read ${systemId} | grep Deployed" |
| 26 | return true |
| 27 | } catch (exception) { |
| 28 | return false |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | stage 'Wait for SSH on the CiaB build node' |
| 35 | sh 'ssh-keygen -f "/home/ubuntu/.ssh/known_hosts" -R 10.90.0.253' |
| 36 | timeout(time: 15) { |
| 37 | waitUntil { |
| 38 | try { |
| 39 | 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" |
| 40 | return true |
| 41 | } catch (exception) { |
| 42 | return false |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | stage 'Run CORD-in-a-Box script' |
| 48 | sh "sshpass -p ${headnodepass} ssh -oStrictHostKeyChecking=no -l ${headnodeuser} 10.90.0.253 bash cord-in-a-box.sh -t" |
| 49 | |
| 50 | currentBuild.result = 'SUCCESS' |
| 51 | } catch (err) { |
| 52 | currentBuild.result = 'FAILURE' |
| 53 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'cord-dev@opencord.org', sendToIndividuals: false]) |
| 54 | } finally { |
| 55 | } |
| 56 | |
| 57 | echo "RESULT: ${currentBuild.result}" |
| 58 | } |