| 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") { | 
| Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 4 | timeout(time: 12, unit: 'HOURS') { | 
|  | 5 | node() { | 
|  | 6 | try{ | 
|  | 7 | def branches = BRANCHES.tokenize(',') | 
|  | 8 | def pollBranches = [] | 
|  | 9 | for (i=0; i < branches.size; i++) { | 
|  | 10 | pollBranches.add([name:branches[i]]) | 
|  | 11 | } | 
|  | 12 | dir("source") { | 
|  | 13 | checkout changelog: true, poll: true, | 
|  | 14 | scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false, | 
|  | 15 | extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: CREDENTIALS_ID, url: SOURCE_URL]]] | 
| Jakub Josef | c158101 | 2018-01-12 14:36:35 +0100 | [diff] [blame] | 16 | git.mirrorGit(SOURCE_URL, TARGET_URL, CREDENTIALS_ID, BRANCHES, true) | 
| Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 17 | } | 
|  | 18 | } catch (Throwable e) { | 
|  | 19 | // If there was an error or exception thrown, the build failed | 
|  | 20 | currentBuild.result = "FAILURE" | 
|  | 21 | currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message | 
|  | 22 | throw e | 
|  | 23 | } finally { | 
|  | 24 | common.sendNotification(currentBuild.result,"",["slack"]) | 
| Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 25 | } | 
| Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 26 | } | 
|  | 27 | } | 
| Filip Pytloun | 38005aa | 2017-03-06 10:26:38 +0100 | [diff] [blame] | 28 | } |