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') { |
alshabib | ef06994 | 2016-09-09 17:08:36 -0700 | [diff] [blame^] | 6 | stage 'Redeploy head node and Build Vagrant box' |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 7 | try { |
alshabib | ef06994 | 2016-09-09 17:08:36 -0700 | [diff] [blame^] | 8 | 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 | ) |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 42 | |
alshabib | ef06994 | 2016-09-09 17:08:36 -0700 | [diff] [blame^] | 43 | stage 'Fetch CORD packages' |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 44 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev' |
alshabib | ef06994 | 2016-09-09 17:08:36 -0700 | [diff] [blame^] | 45 | |
| 46 | stage 'Build CORD Images' |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 47 | sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 48 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 49 | 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' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 51 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 52 | 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' |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 54 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 55 | 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 | } |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 64 | |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 65 | } |