blob: e3f00ad525521ce9bf10ae7fba7ddf2b7acf6770 [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 Josefa63f9862018-01-11 17:58:38 +01003timeout(time: 12, unit: 'HOURS') {
4 node() {
5 try{
6 stage("checkout") {
7 dir("src") {
8 ssh.prepareSshAgentKey(CREDENTIALS_ID)
9 ssh.ensureKnownHosts(SOURCE_URL)
10 git url: SOURCE_URL, branch: "master", credentialsId: CREDENTIALS_ID, poll: false
11 sh("git branch --set-upstream-to=origin/master")
12 ssh.agentSh("make update")
13 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010014 }
Jakub Josefa63f9862018-01-11 17:58:38 +010015 stage("tag") {
16 dir("src/formulas") {
17 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")
18 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010019 }
Jakub Josefa63f9862018-01-11 17:58:38 +010020 stage("push") {
21 dir("src/formulas") {
22 ssh.agentSh("mr --trust-all -j4 --force run git push gerrit $TAG")
23 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010024 }
Jakub Josefa63f9862018-01-11 17:58:38 +010025 } catch (Throwable e) {
26 // If there was an error or exception thrown, the build failed
27 currentBuild.result = "FAILURE"
28 currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
29 throw e
30 } finally {
31 common.sendNotification(currentBuild.result,"",["slack"])
Jakub Josefc5a223a2017-03-01 14:40:08 +010032 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010033 }
Filip Pytloun38005aa2017-03-06 10:26:38 +010034}