alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 1 | node ('build') { |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 2 | stage 'chdir to build' |
| 3 | dir('build') { |
| 4 | try { |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 5 | stage 'Login to Maas' |
| 6 | sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}" |
| 7 | |
| 8 | stage 'Release head node' |
| 9 | sh "maas maas machine release ${systemId}" |
| 10 | sleep 180 |
| 11 | |
| 12 | stage 'Acquire head Node' |
| 13 | sh 'maas maas machines allocate' |
| 14 | |
| 15 | stage 'Deploy head node' |
| 16 | sh "maas maas machine deploy ${systemId}" |
| 17 | |
| 18 | sleep 750 |
| 19 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 20 | stage 'Bring up vagrant box' |
| 21 | sh 'vagrant up corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 22 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 23 | stage 'Fetch build elements' |
| 24 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 25 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 26 | stage 'Build Images' |
| 27 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 28 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 29 | stage 'Publish to headnode' |
| 30 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew -PtargetReg=10.90.0.251:5000 -PdeployConfig=config/onlab_develop_pod.yml publish" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 31 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 32 | stage 'Deploy' |
| 33 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew -PtargetReg=10.90.0.251:5000 -PdeployConfig=config/onlab_develop_pod.yml deploy" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 34 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 35 | currentBuild.result = 'SUCCESS' |
| 36 | } catch (err) { |
| 37 | currentBuild.result = 'FAILURE' |
| 38 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'ali@onlab.us', sendToIndividuals: false]) |
| 39 | } finally { |
| 40 | sh 'vagrant destroy -f corddev' |
| 41 | } |
| 42 | echo "RESULT: ${currentBuild.result}" |
| 43 | } |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame^] | 44 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 45 | } |