blob: 7660636eafe4245dbbc8619b537dfb162299b976 [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 ssh = new com.mirantis.mk.Ssh()
Jakub Josefc5a223a2017-03-01 14:40:08 +01003node() {
4 try{
5 stage("checkout") {
6 dir("src") {
Filip Pytloun38005aa2017-03-06 10:26:38 +01007 ssh.prepareSshAgentKey(CREDENTIALS_ID)
8 ssh.ensureKnownHosts(SOURCE_URL)
Jakub Josefc5a223a2017-03-01 14:40:08 +01009 git url: SOURCE_URL, branch: "master", credentialsId: CREDENTIALS_ID, poll: false
10 sh("git branch --set-upstream-to=origin/master")
Filip Pytloun38005aa2017-03-06 10:26:38 +010011 ssh.agentSh("make update")
Jakub Josefc5a223a2017-03-01 14:40:08 +010012 }
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 Pytloun38005aa2017-03-06 10:26:38 +010021 ssh.agentSh("mr --trust-all -j4 --force run git push gerrit $TAG")
Jakub Josefc5a223a2017-03-01 14:40:08 +010022 }
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 Pytloun38005aa2017-03-06 10:26:38 +010031}