Added 12h timeout to all pipelines

Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/test-salt-formulas-env.groovy b/test-salt-formulas-env.groovy
index f763e5e..8f60727 100644
--- a/test-salt-formulas-env.groovy
+++ b/test-salt-formulas-env.groovy
@@ -20,76 +20,78 @@
 def checkouted = false
 
 throttle(['test-formula']) {
-  node("python") {
-    try {
-      stage("checkout") {
-        if (defaultGitRef && defaultGitUrl) {
-          checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
-        } else {
-          throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_REF is null")
-        }
-      }
-      stage("cleanup") {
-        if (checkouted) {
-          sh("make clean")
-        }
-      }
-      stage("kitchen") {
-        if (checkouted) {
-          if (fileExists(".kitchen.yml")) {
-            common.infoMsg(".kitchen.yml found, running kitchen tests")
-            ruby.ensureRubyEnv()
-            if (fileExists(".travis.yml")) {
-              common.infoMsg(".travis.yml found, running custom kitchen init")
-              def kitchenConfigYML = readYaml(file: ".travis.yml")
-              def kitchenInit = kitchenConfigYML["install"]
-              def kitchenInstalled = false
-              if (kitchenInit && !kitchenInit.isEmpty()) {
-                for (int i = 0; i < kitchenInit.size(); i++) {
-                  if (kitchenInit[i].trim().startsWith("test -e Gemfile")) { //found Gemfile config
-                    common.infoMsg("Custom Gemfile configuration found, using them")
-                    ruby.installKitchen(kitchenInit[i].trim())
-                    kitchenInstalled = true
-                  }
-                }
-              }
-              if (!kitchenInstalled) {
-                ruby.installKitchen()
-              }
-            } else {
-              common.infoMsg(".travis.yml not found, running default kitchen init")
-              ruby.installKitchen()
-            }
-            common.infoMsg("Running part of kitchen test")
-            if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
-              def cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
-              sh("find . -type f -exec sed -i 's/apt.mirantis.com/apt.mirantis.net:8085/g' {} \\;")
-              sh("find . -type f -exec sed -i 's/apt-mk.mirantis.com/apt.mirantis.net:8085/g' {} \\;")
-              def suite = ruby.getSuiteName(KITCHEN_ENV)
-              if (suite && suite != "") {
-                common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
-                ruby.runKitchenTests(cleanEnv, suite)
-              } else {
-                common.warningMsg("No SUITE was found. Running with all suites.")
-                ruby.runKitchenTests(cleanEnv, "")
-              }
-            } else {
-              throw new Exception("KITCHEN_ENV parameter is empty or invalid. This may indicate wrong env settings of initial test job or .travis.yml file.")
-            }
+  timeout(time: 12, unit: 'HOURS') {
+    node("python") {
+      try {
+        stage("checkout") {
+          if (defaultGitRef && defaultGitUrl) {
+            checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
           } else {
-            throw new Exception(".kitchen.yml file not found, no kitchen tests triggered.")
+            throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_REF is null")
           }
         }
-      }
-    } catch (Throwable e) {
-      // If there was an error or exception thrown, the build failed
-      currentBuild.result = "FAILURE"
-      ruby.runKitchenCommand("destroy")
-      throw e
-    } finally {
-      if (currentBuild.result == "FAILURE" && fileExists(".kitchen/logs/kitchen.log")) {
-        common.errorMsg("----------------KITCHEN LOG:---------------")
-        println readFile(".kitchen/logs/kitchen.log")
+        stage("cleanup") {
+          if (checkouted) {
+            sh("make clean")
+          }
+        }
+        stage("kitchen") {
+          if (checkouted) {
+            if (fileExists(".kitchen.yml")) {
+              common.infoMsg(".kitchen.yml found, running kitchen tests")
+              ruby.ensureRubyEnv()
+              if (fileExists(".travis.yml")) {
+                common.infoMsg(".travis.yml found, running custom kitchen init")
+                def kitchenConfigYML = readYaml(file: ".travis.yml")
+                def kitchenInit = kitchenConfigYML["install"]
+                def kitchenInstalled = false
+                if (kitchenInit && !kitchenInit.isEmpty()) {
+                  for (int i = 0; i < kitchenInit.size(); i++) {
+                    if (kitchenInit[i].trim().startsWith("test -e Gemfile")) { //found Gemfile config
+                      common.infoMsg("Custom Gemfile configuration found, using them")
+                      ruby.installKitchen(kitchenInit[i].trim())
+                      kitchenInstalled = true
+                    }
+                  }
+                }
+                if (!kitchenInstalled) {
+                  ruby.installKitchen()
+                }
+              } else {
+                common.infoMsg(".travis.yml not found, running default kitchen init")
+                ruby.installKitchen()
+              }
+              common.infoMsg("Running part of kitchen test")
+              if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
+                def cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
+                sh("find . -type f -exec sed -i 's/apt.mirantis.com/apt.mirantis.net:8085/g' {} \\;")
+                sh("find . -type f -exec sed -i 's/apt-mk.mirantis.com/apt.mirantis.net:8085/g' {} \\;")
+                def suite = ruby.getSuiteName(KITCHEN_ENV)
+                if (suite && suite != "") {
+                  common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
+                  ruby.runKitchenTests(cleanEnv, suite)
+                } else {
+                  common.warningMsg("No SUITE was found. Running with all suites.")
+                  ruby.runKitchenTests(cleanEnv, "")
+                }
+              } else {
+                throw new Exception("KITCHEN_ENV parameter is empty or invalid. This may indicate wrong env settings of initial test job or .travis.yml file.")
+              }
+            } else {
+              throw new Exception(".kitchen.yml file not found, no kitchen tests triggered.")
+            }
+          }
+        }
+      } catch (Throwable e) {
+        // If there was an error or exception thrown, the build failed
+        currentBuild.result = "FAILURE"
+        ruby.runKitchenCommand("destroy")
+        throw e
+      } finally {
+        if (currentBuild.result == "FAILURE" && fileExists(".kitchen/logs/kitchen.log")) {
+          common.errorMsg("----------------KITCHEN LOG:---------------")
+          println readFile(".kitchen/logs/kitchen.log")
+        }
       }
     }
   }