alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 1 | node ('build') { |
alshabib | a5d3a61 | 2016-09-09 11:02:05 -0700 | [diff] [blame^] | 2 | stage 'Checkout cord repo' |
| 3 | checkout changelog: false, poll: false, scm: [$class: 'RepoScm', currentBranch: true, manifestRepositoryUrl: 'https://gerrit.opencord.org/manifest', quiet: true] |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 4 | stage 'chdir to build' |
| 5 | dir('build') { |
| 6 | try { |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 7 | 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 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 22 | stage 'Bring up vagrant box' |
| 23 | sh 'vagrant up corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 24 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 25 | stage 'Fetch build elements' |
| 26 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 27 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 28 | stage 'Build Images' |
| 29 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 30 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 31 | 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' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 33 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 34 | 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' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 36 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 37 | 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 | } |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 46 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 47 | } |