1

We use Jenkins with Gerrit to trigger certain jobs on Jenkins. We use Trigger on Comment Added Contains Regular Expression to run the job. The job executes a shell script using maven mvnw command with some command line parameters for maven execution.

One of these jobs has regex like .*(\+WEB_TEST|\+WT).*. So whenever we want web tests to run, we put comment like +WT on the gerrit patch-set. Now we want to pass an optional parameter to maven through this comment.

Is it possible altogether?

Mukund Jalan
  • 1,145
  • 20
  • 39

1 Answers1

0

I think so... in the job, take a look at the $GERRIT_EVENT_COMMENT_TEXT variable. This variable contains the comments that triggered the job. Your shell script could use the variable contents to add (or not) parameters to the Maven.

See also at: Build pull down menu > Parameters

  • According to the [source code comment](https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerParameters.java), this variable means `Comment posted to Gerrit in a comment-added event.`. However, it just outputs a hash of random letters and numbers for me. So your answer should be correct! I suspect I'm experiencing a bug... – Jonathan Benn Feb 22 '19 at 17:00