creating re-deploy node job for mcord-build to listen to
Change-Id: I52fd70b2377d58ca66c245467817527ea831a3cf
diff --git a/jjb/pipeline/redeploy-node-maas.groovy b/jjb/pipeline/redeploy-node-maas.groovy
new file mode 100644
index 0000000..fe93747
--- /dev/null
+++ b/jjb/pipeline/redeploy-node-maas.groovy
@@ -0,0 +1,54 @@
+/*re-deploy node via maas cli commands. to be used prior to mcord 6.0 build job*/
+
+pipeline {
+
+ /* no label, executor is determined by JJB */
+ agent {
+ label "${params.executorNode}"
+ }
+
+ stages {
+
+ stage ('Re-Deploy Node') {
+ steps {
+ sh "maas login maas http://${maas_ip}/MAAS/api/2.0 ${maas_api_key}"
+ sh "maas maas machine release ${node_id}"
+
+ timeout(time:15) {
+ waitUntil {
+ script {
+ try {
+ sh "maas maas machine read ${node_id} | grep Ready"
+ return true
+ } catch (exception) {
+ return false
+ }
+ }
+ }
+ }
+
+ sh "maas maas machines allocate"
+ sh "maas maas machine deploy ${node_id}"
+
+ timeout(time:15) {
+ waitUntil {
+ script {
+ try {
+ sh "maas maas machine read ${node_id} | grep Deployed"
+ return true
+ } catch (exception) {
+ return false
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ post {
+ always {
+ step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
+ }
+ }
+}