Added 12h timeout to all pipelines
Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/git-mirror-2way-pipeline.groovy b/git-mirror-2way-pipeline.groovy
index c20af8f..5dfb4d1 100644
--- a/git-mirror-2way-pipeline.groovy
+++ b/git-mirror-2way-pipeline.groovy
@@ -1,47 +1,49 @@
def common = new com.mirantis.mk.Common()
def git = new com.mirantis.mk.Git()
stage("Mirror") {
- node() {
- try{
- def branches = BRANCHES.tokenize(',')
- def pollBranches = []
- for (i=0; i < branches.size; i++) {
- pollBranches.add([name:branches[i]])
- }
- dir("target") {
- try{
- checkout changelog: true, poll: true,
- scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
- extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: TARGET_URL]]]
- } catch(hudson.AbortException e){
- if(e.message.trim().equals("Couldn't find any revision to build. Verify the repository and branch configuration for this job.")){
- common.warningMsg("Warning: Cannot checkout target repo source repo is empty")
- } else {
- throw e
- }
- }
- }
- dir("source") {
- try{
- checkout changelog: true, poll: true,
- scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
- extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]]
- } catch(hudson.AbortException e){
+ timeout(time: 12, unit: 'HOURS') {
+ node() {
+ try{
+ def branches = BRANCHES.tokenize(',')
+ def pollBranches = []
+ for (i=0; i < branches.size; i++) {
+ pollBranches.add([name:branches[i]])
+ }
+ dir("target") {
+ try{
+ checkout changelog: true, poll: true,
+ scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
+ extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: TARGET_URL]]]
+ } catch(hudson.AbortException e){
if(e.message.trim().equals("Couldn't find any revision to build. Verify the repository and branch configuration for this job.")){
- common.warningMsg("Warning: Cannot checkout source repo source repo is empty")
+ common.warningMsg("Warning: Cannot checkout target repo source repo is empty")
} else {
throw e
}
- }
- git.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, BRANCHES, true, true, false)
+ }
+ }
+ dir("source") {
+ try{
+ checkout changelog: true, poll: true,
+ scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
+ extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]]
+ } catch(hudson.AbortException e){
+ if(e.message.trim().equals("Couldn't find any revision to build. Verify the repository and branch configuration for this job.")){
+ common.warningMsg("Warning: Cannot checkout source repo source repo is empty")
+ } else {
+ throw e
+ }
+ }
+ git.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, BRANCHES, true, true, false)
+ }
+ } 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
+ } finally {
+ common.sendNotification(currentBuild.result,"",["slack"])
}
- } 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
- } finally {
- common.sendNotification(currentBuild.result,"",["slack"])
}
}
}