blob: edb0af5b48a29e0c77417560e80fcb50cdf3b4ad [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()
Jakub Josefeda07682017-03-09 14:50:54 +01009def ssh = new com.mirantis.mk.Ssh()
Jakub Joseff2a66e92017-03-08 17:21:07 +010010node("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))
Jakub Joseffd91d1f2017-03-08 17:27:41 +010030 }
Jakub Joseff2a66e92017-03-08 17:21:07 +010031 } catch (Throwable e) {
32 // If there was an error or exception thrown, the build failed
33 currentBuild.result = "FAILURE"
34 throw e
35 } finally {
36 common.sendNotification(currentBuild.result,"",["slack"])
37 }
38}