blob: 10fa9a0393e331eb12c376d262bb548c62f880ea [file] [log] [blame]
Jakub Josefc5a223a2017-03-01 14:40:08 +01001def common = new com.mirantis.mk.Common()
Filip Pytloun38005aa2017-03-06 10:26:38 +01002def git = new com.mirantis.mk.Git()
Jakub Josefc5a223a2017-03-01 14:40:08 +01003stage("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 Joseffcb615e2017-04-10 14:34:40 +020013 scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
Jakub Josefc5a223a2017-03-01 14:40:08 +010014 extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]]
Filip Pytloun38005aa2017-03-06 10:26:38 +010015 git.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, BRANCHES)
Jakub Josefc5a223a2017-03-01 14:40:08 +010016 }
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 Pytloun38005aa2017-03-06 10:26:38 +010025}