Added 12h timeout to all pipelines

Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/update-mirror-image.groovy b/update-mirror-image.groovy
index 238dbb2..8bde843 100644
--- a/update-mirror-image.groovy
+++ b/update-mirror-image.groovy
@@ -22,82 +22,83 @@
 def salt = new com.mirantis.mk.Salt()
 def python = new com.mirantis.mk.Python()
 def venvPepper = "venvPepper"
+timeout(time: 12, unit: 'HOURS') {
+    node() {
+        try {
+            python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
 
-node() {
-    try {
-        python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
+            if(UPDATE_APTLY.toBoolean()){
+                stage('Update Aptly mirrors'){
+                    def aptlyMirrorArgs = "-s -v"
 
-        if(UPDATE_APTLY.toBoolean()){
-            stage('Update Aptly mirrors'){
-                def aptlyMirrorArgs = "-s -v"
+                    salt.enforceState(venvPepper, '*apt*', ['aptly.server'], true)
+                    sleep(10)
 
-                salt.enforceState(venvPepper, '*apt*', ['aptly.server'], true)
-                sleep(10)
-
-                if(UPDATE_APTLY_MIRRORS != ""){
-                    common.infoMsg("Updating List of Aptly mirrors.")
-                    UPDATE_APTLY_MIRRORS = UPDATE_APTLY_MIRRORS.replaceAll("\\s","")
-                    def mirrors = UPDATE_APTLY_MIRRORS.tokenize(",")
-                    for(mirror in mirrors){
-                        salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.script', ['salt://aptly/files/aptly_mirror_update.sh', "args=\"${aptlyMirrorArgs} -m ${mirror}\"", 'runas=aptly'], null, true)
+                    if(UPDATE_APTLY_MIRRORS != ""){
+                        common.infoMsg("Updating List of Aptly mirrors.")
+                        UPDATE_APTLY_MIRRORS = UPDATE_APTLY_MIRRORS.replaceAll("\\s","")
+                        def mirrors = UPDATE_APTLY_MIRRORS.tokenize(",")
+                        for(mirror in mirrors){
+                            salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.script', ['salt://aptly/files/aptly_mirror_update.sh', "args=\"${aptlyMirrorArgs} -m ${mirror}\"", 'runas=aptly'], null, true)
+                        }
+                    }
+                    else{
+                        common.infoMsg("Updating all Aptly mirrors.")
+                        salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.script', ['salt://aptly/files/aptly_mirror_update.sh', "args=\"${aptlyMirrorArgs}\"", 'runas=aptly'], null, true)
                     }
                 }
-                else{
-                    common.infoMsg("Updating all Aptly mirrors.")
-                    salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.script', ['salt://aptly/files/aptly_mirror_update.sh', "args=\"${aptlyMirrorArgs}\"", 'runas=aptly'], null, true)
+            }
+            if(PUBLISH_APTLY.toBoolean()){
+                def aptlyPublishArgs = "-av"
+
+                common.infoMsg("Publishing all Aptly snapshots.")
+
+                salt.enforceState(venvPepper, '*apt*', ['aptly.publisher'], true)
+                sleep(10)
+
+                if(CLEANUP_APTLY.toBoolean()){
+                    aptlyPublishArgs += "c"
+                }
+                if(RECREATE_APTLY_PUBLISHES.toBoolean()){
+                    aptlyPublishArgs += "r"
+                }
+                if(FORCE_OVERWRITE_APTLY_PUBLISHES.toBoolean()){
+                    aptlyPublishArgs += "f"
+                }
+                salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.script', ['salt://aptly/files/aptly_publish_update.sh', "args=\"${aptlyPublishArgs}\"", 'runas=aptly'], null, true)
+            }
+            if(UPDATE_DOCKER_REGISTRY.toBoolean()){
+                stage('Update Docker images'){
+                    common.infoMsg("Updating Docker images.")
+                    salt.enforceState(venvPepper, '*apt*', ['docker.client.registry'], true)
+                    if(CLEANUP_DOCKER_CACHE.toBoolean()){
+                        salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['docker system prune --all --force'], null, true)
+                    }
                 }
             }
-        }
-        if(PUBLISH_APTLY.toBoolean()){
-            def aptlyPublishArgs = "-av"
-
-            common.infoMsg("Publishing all Aptly snapshots.")
-
-            salt.enforceState(venvPepper, '*apt*', ['aptly.publisher'], true)
-            sleep(10)
-
-            if(CLEANUP_APTLY.toBoolean()){
-                aptlyPublishArgs += "c"
-            }
-            if(RECREATE_APTLY_PUBLISHES.toBoolean()){
-                aptlyPublishArgs += "r"
-            }
-            if(FORCE_OVERWRITE_APTLY_PUBLISHES.toBoolean()){
-                aptlyPublishArgs += "f"
-            }
-            salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.script', ['salt://aptly/files/aptly_publish_update.sh', "args=\"${aptlyPublishArgs}\"", 'runas=aptly'], null, true)
-        }
-        if(UPDATE_DOCKER_REGISTRY.toBoolean()){
-            stage('Update Docker images'){
-                common.infoMsg("Updating Docker images.")
-                salt.enforceState(venvPepper, '*apt*', ['docker.client.registry'], true)
-                if(CLEANUP_DOCKER_CACHE.toBoolean()){
-                    salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['docker system prune --all --force'], null, true)
+            if(UPDATE_PYPI.toBoolean()){
+                stage('Update PyPi packages'){
+                    common.infoMsg("Updating PyPi packages.")
+                    salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['pip2pi /srv/pypi_mirror/packages/ -r /srv/pypi_mirror/requirements.txt'], null, true)
                 }
             }
-        }
-        if(UPDATE_PYPI.toBoolean()){
-            stage('Update PyPi packages'){
-                common.infoMsg("Updating PyPi packages.")
-                salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['pip2pi /srv/pypi_mirror/packages/ -r /srv/pypi_mirror/requirements.txt'], null, true)
+            if(UPDATE_GIT.toBoolean()){
+                stage('Update Git repositories'){
+                    common.infoMsg("Updating Git repositories.")
+                    salt.enforceState(venvPepper, '*apt*', ['git.server'], true)
+                }
             }
-        }
-        if(UPDATE_GIT.toBoolean()){
-            stage('Update Git repositories'){
-                common.infoMsg("Updating Git repositories.")
-                salt.enforceState(venvPepper, '*apt*', ['git.server'], true)
+            if(UPDATE_IMAGES.toBoolean()){
+                stage('Update VM images'){
+                    common.infoMsg("Updating VM images.")
+                    salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['/srv/scripts/update-images.sh'], null, true)
+                }
             }
+        } catch (Throwable e) {
+            // If there was an error or exception thrown, the build failed
+            currentBuild.result = "FAILURE"
+            currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
+            throw e
         }
-        if(UPDATE_IMAGES.toBoolean()){
-            stage('Update VM images'){
-                common.infoMsg("Updating VM images.")
-                salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['/srv/scripts/update-images.sh'], null, true)
-            }
-        }
-    } catch (Throwable e) {
-        // If there was an error or exception thrown, the build failed
-        currentBuild.result = "FAILURE"
-        currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
-        throw e
     }
 }
\ No newline at end of file