blob: 90ce9efbab9a9f0f20312c2ca10e05312ca00c17 [file] [log] [blame]
Jakub Josefc5a223a2017-03-01 14:40:08 +01001def common = new com.mirantis.mk.Common()
2node() {
3 try{
4 stage("checkout") {
5 dir("src") {
6 common.prepareSshAgentKey(CREDENTIALS_ID)
7 common.ensureKnownHosts(SOURCE_URL)
8 git url: SOURCE_URL, branch: "master", credentialsId: CREDENTIALS_ID, poll: false
9 sh("git branch --set-upstream-to=origin/master")
10 common.agentSh("make update")
11 }
12 }
13 stage("tag") {
14 dir("src/formulas") {
15 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")
16 }
17 }
18 stage("push") {
19 dir("src/formulas") {
20 common.agentSh("mr --trust-all -j4 --force run git push gerrit $TAG")
21 }
22 }
23 } catch (Throwable e) {
24 // If there was an error or exception thrown, the build failed
25 currentBuild.result = "FAILURE"
26 throw e
27 } finally {
28 common.sendNotification(currentBuild.result,"",["slack"])
29 }
30}