Added 12h timeout to all pipelines

Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/build-debian-packages-libvirt-exporter.groovy b/build-debian-packages-libvirt-exporter.groovy
index d373961..2051504 100644
--- a/build-debian-packages-libvirt-exporter.groovy
+++ b/build-debian-packages-libvirt-exporter.groovy
@@ -5,80 +5,81 @@
 
 def timestamp = common.getDatetime()
 def version = "0.1~${timestamp}"
+timeout(time: 12, unit: 'HOURS') {
+    node('docker') {
+        try{
 
-node('docker') {
-    try{
-
-        stage("cleanup") {
-            sh("rm -rf * || true")
-        }
-
-        stage("checkout") {
-            git.checkoutGitRepository(
-                "libvirt-exporter-${version}",
-                "${SOURCE_URL}",
-                SOURCE_BRANCH,
-                SOURCE_CREDENTIALS,
-                true,
-                30,
-                1
-            )
-        }
-
-        stage("build binary") {
-            dir("libvirt-exporter-${version}") {
-                sh("sed -i 's/VERSION/${version}/g' debian/changelog && ./build_static.sh")
+            stage("cleanup") {
+                sh("rm -rf * || true")
             }
-        }
 
-        def img = dockerLib.getImage("tcpcloud/debian-build-ubuntu-${DIST}")
-        stage("build package") {
-            img.inside("-u root:root") {
-                sh("apt-get update && apt-get install ruby ruby-dev && gem install fpm")
-                sh("cd libvirt-exporter-${version} && scripts/build.py --package --version=\"${version}\" --platform=linux --arch=amd64")
+            stage("checkout") {
+                git.checkoutGitRepository(
+                    "libvirt-exporter-${version}",
+                    "${SOURCE_URL}",
+                    SOURCE_BRANCH,
+                    SOURCE_CREDENTIALS,
+                    true,
+                    30,
+                    1
+                )
             }
-            archiveArtifacts artifacts: "libvirt-exporter-${version}/build/*.deb"
-        }
 
-        if (UPLOAD_APTLY.toBoolean()) {
-            lock("aptly-api") {
-                stage("upload") {
-                    def buildSteps = [:]
-                    def debFiles = sh(script: "ls libvirt-exporter-${version}/build/*.deb", returnStdout: true)
-                    def debFilesArray = debFiles.trim().tokenize()
-                    def workspace = common.getWorkspace()
-                    for (int i = 0; i < debFilesArray.size(); i++) {
-                        def debFile = debFilesArray[i];
-                        buildSteps[debFiles[i]] = aptly.uploadPackageStep(
-                            "${workspace}/"+debFile,
-                            APTLY_URL,
-                            APTLY_REPO,
-                            true
-                        )
+            stage("build binary") {
+                dir("libvirt-exporter-${version}") {
+                    sh("sed -i 's/VERSION/${version}/g' debian/changelog && ./build_static.sh")
+                }
+            }
+
+            def img = dockerLib.getImage("tcpcloud/debian-build-ubuntu-${DIST}")
+            stage("build package") {
+                img.inside("-u root:root") {
+                    sh("apt-get update && apt-get install ruby ruby-dev && gem install fpm")
+                    sh("cd libvirt-exporter-${version} && scripts/build.py --package --version=\"${version}\" --platform=linux --arch=amd64")
+                }
+                archiveArtifacts artifacts: "libvirt-exporter-${version}/build/*.deb"
+            }
+
+            if (UPLOAD_APTLY.toBoolean()) {
+                lock("aptly-api") {
+                    stage("upload") {
+                        def buildSteps = [:]
+                        def debFiles = sh(script: "ls libvirt-exporter-${version}/build/*.deb", returnStdout: true)
+                        def debFilesArray = debFiles.trim().tokenize()
+                        def workspace = common.getWorkspace()
+                        for (int i = 0; i < debFilesArray.size(); i++) {
+                            def debFile = debFilesArray[i];
+                            buildSteps[debFiles[i]] = aptly.uploadPackageStep(
+                                "${workspace}/"+debFile,
+                                APTLY_URL,
+                                APTLY_REPO,
+                                true
+                            )
+                        }
+                        parallel buildSteps
                     }
-                    parallel buildSteps
-                }
-                stage("publish") {
-                    aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-                    aptly.publish(APTLY_URL)
+                    stage("publish") {
+                        aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
+                        aptly.publish(APTLY_URL)
+                    }
                 }
             }
+
+            img.inside("-u root:root") {
+                sh("rm -rf * || true")
+            }
+
+        } catch (Throwable e) {
+           // If there was an exception thrown, the build failed
+           currentBuild.result = "FAILURE"
+           currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
+           throw e
+        } finally {
+           common.sendNotification(currentBuild.result,"",["slack"])
+
+           if (currentBuild.result != 'FAILURE') {
+              sh("rm -rf *")
+           }
         }
-
-        img.inside("-u root:root") {
-            sh("rm -rf * || true")
-        }
-
-    } catch (Throwable e) {
-       // If there was an exception thrown, the build failed
-       currentBuild.result = "FAILURE"
-       currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
-       throw e
-    } finally {
-       common.sendNotification(currentBuild.result,"",["slack"])
-
-       if (currentBuild.result != 'FAILURE') {
-          sh("rm -rf *")
-       }
     }
 }