From: Thanh Ha Date: Thu, 10 Aug 2017 20:32:01 +0000 (-0400) Subject: Make Merge and Verify job triggers overrideable X-Git-Tag: v0.7.0~15^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F5835%2F2;p=releng%2Fglobal-jjb.git Make Merge and Verify job triggers overrideable This makes merge and verify jobs that use Gerrit Trigger be able to override the default trigger defined by the job. This is useful in cases where a project may have topic branches that they do not wish to configure their build rules differently. For example in OpenDaylight the NetVirt project has a need for topic branches but they don't want to run testing against every patch submission in the topic branches and would prefer to run them manually. This patch would allow them to reconfigure the triggers in that case for the topic branch. Based on a POC from: https://git.opendaylight.org/gerrit/61385 Change-Id: Idf1d301572bb33f5b540f1011658cdd3f3fc69f5 Signed-off-by: Thanh Ha --- diff --git a/README.md b/README.md index bc6fcc71..c1522bc0 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,17 @@ In this method a job can define a globstar for example `**/*.log` which then causes the archive script to do a globstar search for that pattern and archives any files it finds matching. +## Overriding merge and verify triggers + +The default trigger conditions for Merge and Verify job types are overrideable +in a project configuration by overriding the following variables: + +- gerrit_merge_triggers +- gerrit_verify_triggers + +These variables take a list of trigger-on values as defined in JJB docs here: + + ## Appendix ### ShellCheck diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 40e71850..c130f26c 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -234,6 +234,11 @@ git-url: '$GIT_URL/$GERRIT_PROJECT' + gerrit_merge_triggers: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: remerge$ + ##################### # Job Configuration # ##################### @@ -250,10 +255,7 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: remerge$ + trigger-on: '{obj:gerrit_merge_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' @@ -276,6 +278,15 @@ git-url: '$GIT_URL/$GERRIT_PROJECT' + gerrit_verify_triggers: + - patchset-created-event: + exclude-drafts: false + exclude-trivial-rebase: false + exclude-no-code-change: false + - draft-published-event + - comment-added-contains-event: + comment-contains-value: recheck$ + ##################### # Job Configuration # ##################### @@ -292,14 +303,7 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: - - patchset-created-event: - exclude-drafts: false - exclude-trivial-rebase: false - exclude-no-code-change: false - - draft-published-event - - comment-added-contains-event: - comment-contains-value: recheck$ + trigger-on: '{obj:gerrit_verify_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' @@ -400,6 +404,11 @@ git-url: '$GIT_URL/$GERRIT_PROJECT' + gerrit_merge_triggers: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: remerge$ + ##################### # Job Configuration # ##################### @@ -417,10 +426,7 @@ - timed: '00 10 1 * *' - gerrit: server-name: '{gerrit-server-name}' - trigger-on: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: remerge$ + trigger-on: '{obj:gerrit_merge_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' @@ -446,6 +452,15 @@ build-timeout: 10 git-url: '$GIT_URL/$GERRIT_PROJECT' + gerrit_verify_triggers: + - patchset-created-event: + exclude-drafts: false + exclude-trivial-rebase: false + exclude-no-code-change: false + - draft-published-event + - comment-added-contains-event: + comment-contains-value: recheck$ + ##################### # Job Configuration # ##################### @@ -462,14 +477,7 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: - - patchset-created-event: - exclude-drafts: false - exclude-trivial-rebase: false - exclude-no-code-change: false - - draft-published-event - - comment-added-contains-event: - comment-contains-value: recheck$ + trigger-on: '{obj:gerrit_verify_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index e66f522c..99c06619 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -90,6 +90,23 @@ id: gerrit-tox-verify <<: *lf_tox_verify + ###################### + # Default parameters # + ###################### + + gerrit_verify_triggers: + - patchset-created-event: + exclude-drafts: false + exclude-trivial-rebase: false + exclude-no-code-change: false + - draft-published-event + - comment-added-contains-event: + comment-contains-value: recheck$ + + ##################### + # Job Configuration # + ##################### + scm: - lf-infra-gerrit-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' @@ -102,14 +119,7 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: - - patchset-created-event: - exclude-drafts: false - exclude-trivial-rebase: false - exclude-no-code-change: false - - draft-published-event - - comment-added-contains-event: - comment-contains-value: recheck$ + trigger-on: '{obj:gerrit_verify_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}'