blob: 13db8186eaa22044ddc3703a42bb76c921023725 [file] [log] [blame]
alshabib152823c2016-09-07 23:49:12 -07001node ('build') {
alshabib152823c2016-09-07 23:49:12 -07002 stage 'chdir to build'
3 dir('build') {
4 try {
alshabib61509fb2016-09-09 02:43:20 -07005 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
alshabib152823c2016-09-07 23:49:12 -070020 stage 'Bring up vagrant box'
21 sh 'vagrant up corddev'
alshabib61509fb2016-09-09 02:43:20 -070022
alshabib152823c2016-09-07 23:49:12 -070023 stage 'Fetch build elements'
24 sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev'
alshabib61509fb2016-09-09 02:43:20 -070025
alshabib152823c2016-09-07 23:49:12 -070026 stage 'Build Images'
27 sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev'
alshabib61509fb2016-09-09 02:43:20 -070028
alshabib152823c2016-09-07 23:49:12 -070029 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'
alshabib61509fb2016-09-09 02:43:20 -070031
alshabib152823c2016-09-07 23:49:12 -070032 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'
alshabib61509fb2016-09-09 02:43:20 -070034
alshabib152823c2016-09-07 23:49:12 -070035 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 }
alshabib61509fb2016-09-09 02:43:20 -070044
alshabib152823c2016-09-07 23:49:12 -070045}