blob: 0a003f2730b799c38669f610ad529d37b5686239 [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') {
alshabibef069942016-09-09 17:08:36 -07006 stage 'Redeploy head node and Build Vagrant box'
alshabib152823c2016-09-07 23:49:12 -07007 try {
alshabibef069942016-09-09 17:08:36 -07008 parallel(
9 maasOps: {
10 sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}"
11 sh "maas maas machine release ${systemId}"
12
13 timeout(time: 15) {
14 waitUntil {
15 try {
16 sh "maas maas machine read ${systemId} | grep Ready"
17 return true
18 } catch (exception) {
19 return false
20 }
21 }
22 }
23
24 sh 'maas maas machines allocate'
25 sh "maas maas machine deploy ${systemId}"
26
27 timeout(time: 30) {
28 waitUntil {
29 try {
30 sh "maas maas machine read ${systemId} | grep Deployed"
31 return true
32 } catch (exception) {
33 return false
34 }
35 }
36 }
37
38 }, vagrantOps: {
39 sh 'vagrant up corddev'
40 }, failFast : true
41 )
alshabib61509fb2016-09-09 02:43:20 -070042
alshabibef069942016-09-09 17:08:36 -070043 stage 'Fetch CORD packages'
alshabib152823c2016-09-07 23:49:12 -070044 sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev'
alshabibef069942016-09-09 17:08:36 -070045
46 stage 'Build CORD Images'
alshabib152823c2016-09-07 23:49:12 -070047 sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev'
alshabib61509fb2016-09-09 02:43:20 -070048
alshabib152823c2016-09-07 23:49:12 -070049 stage 'Publish to headnode'
50 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 -070051
alshabib152823c2016-09-07 23:49:12 -070052 stage 'Deploy'
53 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 -070054
alshabib152823c2016-09-07 23:49:12 -070055 currentBuild.result = 'SUCCESS'
56 } catch (err) {
57 currentBuild.result = 'FAILURE'
58 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'ali@onlab.us', sendToIndividuals: false])
59 } finally {
60 sh 'vagrant destroy -f corddev'
61 }
62 echo "RESULT: ${currentBuild.result}"
63 }
alshabib61509fb2016-09-09 02:43:20 -070064
alshabib152823c2016-09-07 23:49:12 -070065}