blob: f481f9757a7f450f1ffb8740756f404ffc2a4898 [file] [log] [blame]
alshabib152823c2016-09-07 23:49:12 -07001node ('build') {
alshabiba5d3a612016-09-09 11:02:05 -07002 stage 'Checkout cord repo'
3 checkout changelog: false, poll: false, scm: [$class: 'RepoScm', currentBranch: true, manifestRepositoryUrl: 'https://gerrit.opencord.org/manifest', quiet: true]
alshabib152823c2016-09-07 23:49:12 -07004 stage 'chdir to build'
5 dir('build') {
6 try {
alshabib61509fb2016-09-09 02:43:20 -07007 stage 'Login to Maas'
8 sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}"
9
10 stage 'Release head node'
11 sh "maas maas machine release ${systemId}"
12 sleep 180
13
14 stage 'Acquire head Node'
15 sh 'maas maas machines allocate'
16
17 stage 'Deploy head node'
18 sh "maas maas machine deploy ${systemId}"
19
20 sleep 750
21
alshabib152823c2016-09-07 23:49:12 -070022 stage 'Bring up vagrant box'
23 sh 'vagrant up corddev'
alshabib61509fb2016-09-09 02:43:20 -070024
alshabib152823c2016-09-07 23:49:12 -070025 stage 'Fetch build elements'
26 sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev'
alshabib61509fb2016-09-09 02:43:20 -070027
alshabib152823c2016-09-07 23:49:12 -070028 stage 'Build Images'
29 sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev'
alshabib61509fb2016-09-09 02:43:20 -070030
alshabib152823c2016-09-07 23:49:12 -070031 stage 'Publish to headnode'
32 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 -070033
alshabib152823c2016-09-07 23:49:12 -070034 stage 'Deploy'
35 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 -070036
alshabib152823c2016-09-07 23:49:12 -070037 currentBuild.result = 'SUCCESS'
38 } catch (err) {
39 currentBuild.result = 'FAILURE'
40 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'ali@onlab.us', sendToIndividuals: false])
41 } finally {
42 sh 'vagrant destroy -f corddev'
43 }
44 echo "RESULT: ${currentBuild.result}"
45 }
alshabib61509fb2016-09-09 02:43:20 -070046
alshabib152823c2016-09-07 23:49:12 -070047}