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