| 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 ssh = new com.mirantis.mk.Ssh() | 
| Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 3 | node() { | 
|  | 4 | try{ | 
|  | 5 | stage("checkout") { | 
|  | 6 | dir("src") { | 
| Filip Pytloun | 38005aa | 2017-03-06 10:26:38 +0100 | [diff] [blame] | 7 | ssh.prepareSshAgentKey(CREDENTIALS_ID) | 
|  | 8 | ssh.ensureKnownHosts(SOURCE_URL) | 
| Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 9 | git url: SOURCE_URL, branch: "master", credentialsId: CREDENTIALS_ID, poll: false | 
|  | 10 | sh("git branch --set-upstream-to=origin/master") | 
| Filip Pytloun | 38005aa | 2017-03-06 10:26:38 +0100 | [diff] [blame] | 11 | ssh.agentSh("make update") | 
| Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 12 | } | 
|  | 13 | } | 
|  | 14 | stage("tag") { | 
|  | 15 | dir("src/formulas") { | 
|  | 16 | sh("for i in *; do cd \$i; git remote | grep gerrit || git remote add gerrit $GERRIT_BASE/\$i; git config user.name Jenkins; git config user.email autobuild@mirantis.com; git tag -m $TAG $TAG; cd ..; done") | 
|  | 17 | } | 
|  | 18 | } | 
|  | 19 | stage("push") { | 
|  | 20 | dir("src/formulas") { | 
| Filip Pytloun | 38005aa | 2017-03-06 10:26:38 +0100 | [diff] [blame] | 21 | ssh.agentSh("mr --trust-all -j4 --force run git push gerrit $TAG") | 
| Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 22 | } | 
|  | 23 | } | 
|  | 24 | } catch (Throwable e) { | 
|  | 25 | // If there was an error or exception thrown, the build failed | 
|  | 26 | currentBuild.result = "FAILURE" | 
|  | 27 | throw e | 
|  | 28 | } finally { | 
|  | 29 | common.sendNotification(currentBuild.result,"",["slack"]) | 
|  | 30 | } | 
| Filip Pytloun | 38005aa | 2017-03-06 10:26:38 +0100 | [diff] [blame] | 31 | } |