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 | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 3 | timeout(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 Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 14 | } |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 15 | 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 Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 19 | } |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 20 | stage("push") { |
| 21 | dir("src/formulas") { |
| 22 | ssh.agentSh("mr --trust-all -j4 --force run git push gerrit $TAG") |
| 23 | } |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 24 | } |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 25 | } 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 Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 32 | } |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 33 | } |
Filip Pytloun | 38005aa | 2017-03-06 10:26:38 +0100 | [diff] [blame] | 34 | } |