Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 1 | def common = new com.mirantis.mk.Common() |
| 2 | stage("Mirror") { |
| 3 | node() { |
| 4 | try{ |
| 5 | def branches = BRANCHES.tokenize(',') |
| 6 | def pollBranches = [] |
| 7 | for (i=0; i < branches.size; i++) { |
| 8 | pollBranches.add([name:branches[i]]) |
| 9 | } |
| 10 | dir("source") { |
| 11 | checkout changelog: true, poll: true, |
| 12 | scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false, submoduleCfg: [], |
| 13 | extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]] |
| 14 | common.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, BRANCHES) |
| 15 | } |
| 16 | } catch (Throwable e) { |
| 17 | // If there was an error or exception thrown, the build failed |
| 18 | currentBuild.result = "FAILURE" |
| 19 | throw e |
| 20 | } finally { |
| 21 | common.sendNotification(currentBuild.result,"",["slack"]) |
| 22 | } |
| 23 | } |
| 24 | } |