blob: 8b4a534df2e91ab7b19f2e0bfa9f10dd20594564 [file] [log] [blame]
Jakub Joseff2a66e92017-03-08 17:21:07 +01001/**
2 * Gerrit gating pipeline
3 * CREDENTIALS_ID - Gerrit credentails ID
4 *
5**/
6
7def common = new com.mirantis.mk.Common()
8def gerrit = new com.mirantis.mk.Gerrit()
9def ssh = new com.mirantis.mk.Salt()
10node("python") {
11 try{
12 stage("test") {
13 /*
14 wrap([$class: 'AnsiColorBuildWrapper']) {
15 build job: "test-${GERRIT_PROJECT}", parameters: [
16 [$class: 'StringParameterValue', name: 'GERRIT_BRANCH', value: GERRIT_BRANCH],
17 [$class: 'StringParameterValue', name: 'GERRIT_NAME', value: GERRIT_NAME],
18 [$class: 'StringParameterValue', name: 'GERRIT_HOST', value: GERRIT_HOST],
19 [$class: 'StringParameterValue', name: 'GERRIT_PORT', value: GERRIT_PORT],
20 [$class: 'StringParameterValue', name: 'GERRIT_PROJECT', value: GERRIT_PROJECT],
21 [$class: 'StringParameterValue', name: 'GERRIT_REFSPEC', value: GERRIT_REFSPEC]
22 ]
23 }*/
24 }
25 stage("submit review"){
26 ssh.prepareSshAgentKey(CREDENTIALS_ID)
27 ssh.ensureKnownHosts(GERRIT_HOST)
28 ssh.agentSh(String.format("ssh -p 29418 %s gerrit review --submit %s,%s", GERRIT_HOST, GERRIT_CHANGE_NUMBER, GERRIT_PATCHSET_NUMBER))
29 println(String.format("Gerrit review %s,%s submitted", GERRIT_CHANGE_NUMBER, GERRIT_PATCHSET_NUMBER))
30 } catch (Throwable e) {
31 // If there was an error or exception thrown, the build failed
32 currentBuild.result = "FAILURE"
33 throw e
34 } finally {
35 common.sendNotification(currentBuild.result,"",["slack"])
36 }
37}