[workflow-plugin] gerrit trigger work around

51 views
Skip to first unread message

Arek Skalski

unread,
Feb 20, 2015, 5:35:01 AM2/20/15
to jenkins...@googlegroups.com

waiting for https://issues.jenkins-ci.org/browse/JENKINS-26010

Simple work around:
  1. Create free style project
  2. connect to gerrit "As usual"
  3. add groovy system script execution build step
  4. trigger workflow from here (one or many)
  5. wait for result
  6. reply to gerrit with result

How to trigger a job from groovy? One of the possibilities

import hudson.model.*
def job = Hudson.instance.getJob("Job Name")
def mybuild = job.scheduleBuild2(0)
def myresult = mybuild.get()
print myresult.result

Additionally parameters should be passed into the triggered workflow to get information about gerrit patchset

def params = [new hudson.model.StringParameterValue("GERRIT_PATCHSET_REVISION", $GERRIT_PATCHSET_REVISION)]
def myaction = new hudson.model.ParametersAction(params)
def mybuild = job.scheduleBuild2(0, myaction)




Reply all
Reply to author
Forward
0 new messages