Added 12h timeout to all pipelines

Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index abdecf9..836b084 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -115,87 +115,88 @@
 } catch (MissingPropertyException e) {
   gerritRef = null
 }
+timeout(time: 12, unit: 'HOURS') {
+    node("python&&docker") {
+        def templateEnv = "${env.WORKSPACE}"
+        def cutterEnv = "${env.WORKSPACE}/cutter"
+        def jinjaEnv = "${env.WORKSPACE}/jinja"
 
-node("python&&docker") {
-    def templateEnv = "${env.WORKSPACE}"
-    def cutterEnv = "${env.WORKSPACE}/cutter"
-    def jinjaEnv = "${env.WORKSPACE}/jinja"
-
-    try {
-        stage("Cleanup") {
-            sh("rm -rf * || true")
-        }
-
-        stage ('Download Cookiecutter template') {
-            if (gerritRef) {
-                def gerritChange = gerrit.getGerritChange(GERRIT_NAME, GERRIT_HOST, GERRIT_CHANGE_NUMBER, CREDENTIALS_ID)
-                merged = gerritChange.status == "MERGED"
-                if(!merged){
-                    checkouted = gerrit.gerritPatchsetCheckout ([
-                        credentialsId : CREDENTIALS_ID
-                    ])
-                } else{
-                    common.successMsg("Change ${GERRIT_CHANGE_NUMBER} is already merged, no need to gate them")
-                }
-            } else {
-                git.checkoutGitRepository(templateEnv, COOKIECUTTER_TEMPLATE_URL, COOKIECUTTER_TEMPLATE_BRANCH, CREDENTIALS_ID)
+        try {
+            stage("Cleanup") {
+                sh("rm -rf * || true")
             }
-        }
 
-        stage("Setup") {
-            python.setupCookiecutterVirtualenv(cutterEnv)
-        }
-
-        stage("Check workflow_definition") {
-            sh "python ${env.WORKSPACE}/workflow_definition_test.py"
-        }
-
-        def contextFiles
-        dir("${templateEnv}/contexts") {
-            contextFiles = findFiles(glob: "*.yml")
-        }
-
-        def contextFileList = []
-        for (int i = 0; i < contextFiles.size(); i++) {
-            contextFileList << contextFiles[i]
-        }
-
-        stage("generate-model") {
-            for (contextFile in contextFileList) {
-                generateModel(contextFile, cutterEnv)
-            }
-        }
-
-        dir("${env.WORKSPACE}") {
-            sh(returnStatus: true, script: "tar -zcvf model.tar.gz -C model .")
-            archiveArtifacts artifacts: "model.tar.gz"
-        }
-
-        stage("test-nodes") {
-            def partitions = common.partitionList(contextFileList, PARALLEL_NODE_GROUP_SIZE.toInteger())
-            def buildSteps = [:]
-            for (int i = 0; i < partitions.size(); i++) {
-                def partition = partitions[i]
-                buildSteps.put("partition-${i}", new HashMap<String,org.jenkinsci.plugins.workflow.cps.CpsClosure2>())
-                for(int k = 0; k < partition.size; k++){
-                    def basename = sh(script: "basename ${partition[k]} .yml", returnStdout: true).trim()
-                    def testEnv = "${env.WORKSPACE}/model/${basename}"
-                    buildSteps.get("partition-${i}").put(basename, { testModel(basename, testEnv) })
+            stage ('Download Cookiecutter template') {
+                if (gerritRef) {
+                    def gerritChange = gerrit.getGerritChange(GERRIT_NAME, GERRIT_HOST, GERRIT_CHANGE_NUMBER, CREDENTIALS_ID)
+                    merged = gerritChange.status == "MERGED"
+                    if(!merged){
+                        checkouted = gerrit.gerritPatchsetCheckout ([
+                            credentialsId : CREDENTIALS_ID
+                        ])
+                    } else{
+                        common.successMsg("Change ${GERRIT_CHANGE_NUMBER} is already merged, no need to gate them")
+                    }
+                } else {
+                    git.checkoutGitRepository(templateEnv, COOKIECUTTER_TEMPLATE_URL, COOKIECUTTER_TEMPLATE_BRANCH, CREDENTIALS_ID)
                 }
             }
-            common.serial(buildSteps)
-        }
 
-        stage ('Clean workspace directories') {
-            sh(returnStatus: true, script: "rm -rfv * > /dev/null || true")
-        }
+            stage("Setup") {
+                python.setupCookiecutterVirtualenv(cutterEnv)
+            }
 
-    } catch (Throwable e) {
-         currentBuild.result = "FAILURE"
-         currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
-         throw e
-    } finally {
-         def dummy = "dummy"
-         //FAILING common.sendNotification(currentBuild.result,"",["slack"])
+            stage("Check workflow_definition") {
+                sh "python ${env.WORKSPACE}/workflow_definition_test.py"
+            }
+
+            def contextFiles
+            dir("${templateEnv}/contexts") {
+                contextFiles = findFiles(glob: "*.yml")
+            }
+
+            def contextFileList = []
+            for (int i = 0; i < contextFiles.size(); i++) {
+                contextFileList << contextFiles[i]
+            }
+
+            stage("generate-model") {
+                for (contextFile in contextFileList) {
+                    generateModel(contextFile, cutterEnv)
+                }
+            }
+
+            dir("${env.WORKSPACE}") {
+                sh(returnStatus: true, script: "tar -zcvf model.tar.gz -C model .")
+                archiveArtifacts artifacts: "model.tar.gz"
+            }
+
+            stage("test-nodes") {
+                def partitions = common.partitionList(contextFileList, PARALLEL_NODE_GROUP_SIZE.toInteger())
+                def buildSteps = [:]
+                for (int i = 0; i < partitions.size(); i++) {
+                    def partition = partitions[i]
+                    buildSteps.put("partition-${i}", new HashMap<String,org.jenkinsci.plugins.workflow.cps.CpsClosure2>())
+                    for(int k = 0; k < partition.size; k++){
+                        def basename = sh(script: "basename ${partition[k]} .yml", returnStdout: true).trim()
+                        def testEnv = "${env.WORKSPACE}/model/${basename}"
+                        buildSteps.get("partition-${i}").put(basename, { testModel(basename, testEnv) })
+                    }
+                }
+                common.serial(buildSteps)
+            }
+
+            stage ('Clean workspace directories') {
+                sh(returnStatus: true, script: "rm -rfv * > /dev/null || true")
+            }
+
+        } catch (Throwable e) {
+             currentBuild.result = "FAILURE"
+             currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
+             throw e
+        } finally {
+             def dummy = "dummy"
+             //FAILING common.sendNotification(currentBuild.result,"",["slack"])
+        }
     }
 }