Added 12h timeout to all pipelines

Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/restore-cassandra.groovy b/restore-cassandra.groovy
index 586940b..ffc035a 100644
--- a/restore-cassandra.groovy
+++ b/restore-cassandra.groovy
@@ -12,69 +12,70 @@
 def python = new com.mirantis.mk.Python()
 
 def pepperEnv = "pepperEnv"
+timeout(time: 12, unit: 'HOURS') {
+    node() {
 
-node() {
-
-    stage('Setup virtualenv for Pepper') {
-        python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
-    }
-
-    stage('Start restore') {
-        // # actual upgrade
-
-        stage('Ask for manual confirmation') {
-            input message: "Are you sure you have the correct backups ready? Do you really want to continue to restore Cassandra?"
-        }
-        // Cassandra restore section
-        try {
-            salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'service.stop', ['supervisor-database'], null, true)
-        } catch (Exception er) {
-            common.warningMsg('Supervisor-database service already stopped')
-        }
-        try {
-            salt.cmdRun(pepperEnv, 'I@opencontrail:control', "mkdir -p /root/cassandra/cassandra.bak")
-        } catch (Exception er) {
-            common.warningMsg('Directory already exists')
+        stage('Setup virtualenv for Pepper') {
+            python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
         }
 
-        try {
-            salt.cmdRun(pepperEnv, 'I@opencontrail:control', "mv /var/lib/cassandra/* /root/cassandra/cassandra.bak")
-        } catch (Exception er) {
-            common.warningMsg('Files were already moved')
+        stage('Start restore') {
+            // # actual upgrade
+
+            stage('Ask for manual confirmation') {
+                input message: "Are you sure you have the correct backups ready? Do you really want to continue to restore Cassandra?"
+            }
+            // Cassandra restore section
+            try {
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'service.stop', ['supervisor-database'], null, true)
+            } catch (Exception er) {
+                common.warningMsg('Supervisor-database service already stopped')
+            }
+            try {
+                salt.cmdRun(pepperEnv, 'I@opencontrail:control', "mkdir -p /root/cassandra/cassandra.bak")
+            } catch (Exception er) {
+                common.warningMsg('Directory already exists')
+            }
+
+            try {
+                salt.cmdRun(pepperEnv, 'I@opencontrail:control', "mv /var/lib/cassandra/* /root/cassandra/cassandra.bak")
+            } catch (Exception er) {
+                common.warningMsg('Files were already moved')
+            }
+            try {
+                salt.cmdRun(pepperEnv, 'I@opencontrail:control', "rm -rf /var/lib/cassandra/*")
+            } catch (Exception er) {
+                common.warningMsg('Directory already empty')
+            }
+
+            _pillar = salt.getPillar(pepperEnv, "I@cassandra:backup:client", 'cassandra:backup:backup_dir')
+            backup_dir = _pillar['return'][0].values()[0]
+            if(backup_dir == null || backup_dir.isEmpty()) { backup_dir='/var/backups/cassandra' }
+            print(backup_dir)
+            salt.runSaltProcessStep(pepperEnv, 'I@cassandra:backup:client', 'file.remove', ["${backup_dir}/dbrestored"], null, true)
+
+            salt.runSaltProcessStep(pepperEnv, 'I@cassandra:backup:client', 'service.start', ['supervisor-database'], null, true)
+
+            // wait until supervisor-database service is up
+            salt.commandStatus(pepperEnv, 'I@cassandra:backup:client', 'service supervisor-database status', 'running')
+            sleep(5)
+            // performs restore
+            salt.cmdRun(pepperEnv, 'I@cassandra:backup:client', "su root -c 'salt-call state.sls cassandra'")
+            salt.runSaltProcessStep(pepperEnv, 'I@cassandra:backup:client', 'system.reboot', null, null, true, 5)
+            salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and not I@cassandra:backup:client', 'system.reboot', null, null, true, 5)
+
+            // wait until supervisor-database service is up
+            salt.commandStatus(pepperEnv, 'I@cassandra:backup:client', 'service supervisor-database status', 'running')
+            salt.commandStatus(pepperEnv, 'I@opencontrail:control and not I@cassandra:backup:client', 'service supervisor-database status', 'running')
+            sleep(5)
+
+            salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'service.restart', ['supervisor-database'], null, true)
+
+            // wait until contrail-status is up
+            salt.commandStatus(pepperEnv, 'I@opencontrail:control', "contrail-status | grep -v == | grep -v \'disabled on boot\' | grep -v nodemgr | grep -v active | grep -v backup", null, false)
+            
+            salt.cmdRun(pepperEnv, 'I@opencontrail:control', "nodetool status")
+            salt.cmdRun(pepperEnv, 'I@opencontrail:control', "contrail-status")
         }
-        try {
-            salt.cmdRun(pepperEnv, 'I@opencontrail:control', "rm -rf /var/lib/cassandra/*")
-        } catch (Exception er) {
-            common.warningMsg('Directory already empty')
-        }
-
-        _pillar = salt.getPillar(pepperEnv, "I@cassandra:backup:client", 'cassandra:backup:backup_dir')
-        backup_dir = _pillar['return'][0].values()[0]
-        if(backup_dir == null || backup_dir.isEmpty()) { backup_dir='/var/backups/cassandra' }
-        print(backup_dir)
-        salt.runSaltProcessStep(pepperEnv, 'I@cassandra:backup:client', 'file.remove', ["${backup_dir}/dbrestored"], null, true)
-
-        salt.runSaltProcessStep(pepperEnv, 'I@cassandra:backup:client', 'service.start', ['supervisor-database'], null, true)
-
-        // wait until supervisor-database service is up
-        salt.commandStatus(pepperEnv, 'I@cassandra:backup:client', 'service supervisor-database status', 'running')
-        sleep(5)
-        // performs restore
-        salt.cmdRun(pepperEnv, 'I@cassandra:backup:client', "su root -c 'salt-call state.sls cassandra'")
-        salt.runSaltProcessStep(pepperEnv, 'I@cassandra:backup:client', 'system.reboot', null, null, true, 5)
-        salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and not I@cassandra:backup:client', 'system.reboot', null, null, true, 5)
-
-        // wait until supervisor-database service is up
-        salt.commandStatus(pepperEnv, 'I@cassandra:backup:client', 'service supervisor-database status', 'running')
-        salt.commandStatus(pepperEnv, 'I@opencontrail:control and not I@cassandra:backup:client', 'service supervisor-database status', 'running')
-        sleep(5)
-
-        salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'service.restart', ['supervisor-database'], null, true)
-
-        // wait until contrail-status is up
-        salt.commandStatus(pepperEnv, 'I@opencontrail:control', "contrail-status | grep -v == | grep -v \'disabled on boot\' | grep -v nodemgr | grep -v active | grep -v backup", null, false)
-        
-        salt.cmdRun(pepperEnv, 'I@opencontrail:control', "nodetool status")
-        salt.cmdRun(pepperEnv, 'I@opencontrail:control', "contrail-status")
     }
 }