Fix typo in git-mirror job
Change-Id: I8355774aa63711b7d33f43d3c24ab926937ef473
Prod-related: PROD-29632 (PROD:29632)
diff --git a/git-mirror-pipeline.groovy b/git-mirror-pipeline.groovy
index 8766678..fa49bbc 100644
--- a/git-mirror-pipeline.groovy
+++ b/git-mirror-pipeline.groovy
@@ -1,32 +1,32 @@
def common = new com.mirantis.mk.Common()
def git = new com.mirantis.mk.Git()
-stage("Mirror") {
- timeout(time: 12, unit: 'HOURS') {
- node() {
- try{
- if (BRANCHES.equals("*") || BRANCHES.contains('*')) {
- branches = git.getBranchesForGitRepo(SOURCE_URL, BRANCHES)
- } else {
- branches = BRANCHES.tokenize(',')
+
+stage('Mirror') {
+ timeout(time: 12, unit: 'HOURS') {
+ node() {
+ try {
+ if (BRANCHES == '*' || BRANCHES.contains('*')) {
+ branches = git.getBranchesForGitRepo(SOURCE_URL, BRANCHES)
+ } else {
+ branches = BRANCHES.tokenize(',')
+ }
+ common.infoMsg('branches to fetch:' + branches.toString())
+ def pollBranches = []
+ for (i = 0; i < branches.size(); i++) {
+ pollBranches.add([name: branches[i]])
+ }
+ dir('source') {
+ checkout changelog: true, poll: true,
+ scm: [$class : 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
+ extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]]
+ git.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, branches, 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
+ }
}
- def pollBranches = []
- for (i=0; i < branches.size(); i++) {
- pollBranches.add([name:branches[i]])
- }
- dir("source") {
- checkout changelog: true, poll: true,
- scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
- extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]]
- git.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, BRANCHES, 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
- } finally {
- common.sendNotification(currentBuild.result,"",["slack"])
- }
}
- }
}