Optimize the jjb-deploy trigger regex to trigger the job _only_
when the Gerrit CR comment is intended as a command.
The `jjb-deploy` job presently gets triggered and is waste of infra
resources when the keyword is intended as comment in Gerrit.
Ref: https://git.opendaylight.org/gerrit/#/c/80358/
Issue: RELENG-1847
Change-Id: I3b35adb1284d3d9029ba025bf660b66fbb5d98e0
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
.. note::
+ The JJB Deploy Job is configured to trigger only if the Gerrit comment
+ starts with the `jjb-deploy` keyword.
+
+ Example of a valid command in Gerrit comment that triggers the job:
+
+ ``jjb-deploy builder-jjb-*``
+
+ Example of a invalid command in Gerrit comment that would _not_ trigger
+ the job:
+
+ ``Update the job. jjb-deploy builder-jjb-*``
+
JOB_NAME can include the * wildcard character to push multiple jobs
matching the pattern. For example ``jjb-deploy builder-jjb-*`` will push
all builder-jjb-* jobs to the sandbox system.
submodule-timeout: 10
gerrit_jjb_deploy_job_triggers:
- comment-added-contains-event:
- comment-contains-value: 'jjb-deploy[:]* (?!\*+$).+$'
+ comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(jjb-deploy[:]* (?!\*+$).+$)'
#####################
# Job Configuration #
--- /dev/null
+---
+fixes:
+ - |
+ The JJB Deploy Job is configured to trigger only if the Gerrit comment
+ starts with the `jjb-deploy` keyword.
+
+ Without the regex being optimized the job triggers on any occurance
+ of the `jjb-deploy` keyword in a Gerrit comment, with is waste infra
+ resources.
+
+ Example of a valid command in Gerrit comment that triggers the job:
+
+ ``jjb-deploy builder-jjb-*``
+
+ Example of a invalid command in Gerrit comment that would _not_ trigger
+ the job:
+
+ ``Update the job. jjb-deploy builder-jjb-*``