From c3128e6979246c6dadb83be4a14b5179b5d53721 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Fri, 8 Mar 2019 04:04:32 +1000 Subject: [PATCH] Optimize the jjb-deploy trigger regex 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 --- docs/jjb/lf-ci-jobs.rst | 12 ++++++++++++ jjb/lf-ci-jobs.yaml | 2 +- .../optimize-jjb-deploy-regex-5ecc4287ecbc3317.yaml | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/optimize-jjb-deploy-regex-5ecc4287ecbc3317.yaml diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index a6d67c20..79c09296 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -369,6 +369,18 @@ This job checks out the current code review patch and then runs a .. 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. diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index bdcd65ef..925ec4ed 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -598,7 +598,7 @@ 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 # diff --git a/releasenotes/notes/optimize-jjb-deploy-regex-5ecc4287ecbc3317.yaml b/releasenotes/notes/optimize-jjb-deploy-regex-5ecc4287ecbc3317.yaml new file mode 100644 index 00000000..8511d72c --- /dev/null +++ b/releasenotes/notes/optimize-jjb-deploy-regex-5ecc4287ecbc3317.yaml @@ -0,0 +1,18 @@ +--- +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-*`` -- 2.16.6