blob: 3cc1f135095923aff447711bea632f588ff2c8b7 [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 dir('build') {
alshabibef069942016-09-09 17:08:36 -07005 stage 'Redeploy head node and Build Vagrant box'
alshabib152823c2016-09-07 23:49:12 -07006 try {
alshabibef069942016-09-09 17:08:36 -07007 parallel(
8 maasOps: {
9 sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}"
10 sh "maas maas machine release ${systemId}"
11
12 timeout(time: 15) {
13 waitUntil {
14 try {
15 sh "maas maas machine read ${systemId} | grep Ready"
16 return true
17 } catch (exception) {
18 return false
19 }
20 }
21 }
22
23 sh 'maas maas machines allocate'
24 sh "maas maas machine deploy ${systemId}"
25
26 timeout(time: 30) {
27 waitUntil {
28 try {
29 sh "maas maas machine read ${systemId} | grep Deployed"
30 return true
31 } catch (exception) {
32 return false
33 }
34 }
35 }
36
37 }, vagrantOps: {
38 sh 'vagrant up corddev'
39 }, failFast : true
40 )
alshabib61509fb2016-09-09 02:43:20 -070041
alshabibef069942016-09-09 17:08:36 -070042 stage 'Fetch CORD packages'
alshabib152823c2016-09-07 23:49:12 -070043 sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev'
alshabibef069942016-09-09 17:08:36 -070044
45 stage 'Build CORD Images'
alshabib152823c2016-09-07 23:49:12 -070046 sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev'
alshabib61509fb2016-09-09 02:43:20 -070047
alshabib152823c2016-09-07 23:49:12 -070048 stage 'Publish to headnode'
49 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 -070050
alshabib152823c2016-09-07 23:49:12 -070051 stage 'Deploy'
52 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 -070053
alshabib152823c2016-09-07 23:49:12 -070054 currentBuild.result = 'SUCCESS'
alshabib81048bd2016-09-09 18:08:07 -070055 step([$class: 'Mailer', recipients: 'cord-dev@opencord.org', sendToIndividuals: false])
alshabib152823c2016-09-07 23:49:12 -070056 } catch (err) {
57 currentBuild.result = 'FAILURE'
alshabib81048bd2016-09-09 18:08:07 -070058 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'cord-dev@opencord.org', sendToIndividuals: false])
alshabib152823c2016-09-07 23:49:12 -070059 } 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}