blob: fe937479b2808aadf5dc6c2abeeb6e6764fa7ffb [file] [log] [blame]
Kailash Khalasi52bd7fc2018-07-03 13:49:44 -07001/*re-deploy node via maas cli commands. to be used prior to mcord 6.0 build job*/
2
3pipeline {
4
5 /* no label, executor is determined by JJB */
6 agent {
7 label "${params.executorNode}"
8 }
9
10 stages {
11
12 stage ('Re-Deploy Node') {
13 steps {
14 sh "maas login maas http://${maas_ip}/MAAS/api/2.0 ${maas_api_key}"
15 sh "maas maas machine release ${node_id}"
16
17 timeout(time:15) {
18 waitUntil {
19 script {
20 try {
21 sh "maas maas machine read ${node_id} | grep Ready"
22 return true
23 } catch (exception) {
24 return false
25 }
26 }
27 }
28 }
29
30 sh "maas maas machines allocate"
31 sh "maas maas machine deploy ${node_id}"
32
33 timeout(time:15) {
34 waitUntil {
35 script {
36 try {
37 sh "maas maas machine read ${node_id} | grep Deployed"
38 return true
39 } catch (exception) {
40 return false
41 }
42 }
43 }
44 }
45 }
46 }
47 }
48
49 post {
50 always {
51 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
52 }
53 }
54}