blob: 5035fe631cfb4cee3cf8072f8813a1eaa378d4d4 [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"
Jakub Josefd2efd7d2017-08-22 17:49:57 +020020 currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
Jakub Josefc5a223a2017-03-01 14:40:08 +010021 throw e
22 } finally {
23 common.sendNotification(currentBuild.result,"",["slack"])
24 }
25 }
Filip Pytloun38005aa2017-03-06 10:26:38 +010026}