diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index e69d60dca..998b7b612 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -367,6 +367,15 @@ def gerrit(parser, xml_parent, data): * **pattern** (`str`) -- Topic name pattern to match + * **disable-strict-forbidden-file-verification** (`bool`) -- + Enabling this option will allow an event to trigger a + build if the event contains BOTH one or more wanted file + paths AND one or more forbidden file paths. In other + words, with this option, the build will not get + triggered if the change contains only forbidden files, + otherwise it will get triggered. Requires plugin + version >= 2.16.0 (default false) + :arg dict skip-vote: map of build outcomes for which Jenkins must skip vote. Requires Gerrit Trigger Plugin version >= 2.7.0 @@ -521,6 +530,11 @@ def gerrit(parser, xml_parent, data): 'PLAIN')) XML.SubElement(topic_tag, 'pattern').text = topic['pattern'] + XML.SubElement(gproj, + 'disableStrictForbiddenFileVerification').text = str( + project.get('disable-strict-forbidden-file-verification', + False)).lower() + build_gerrit_skip_votes(gtrig, data) XML.SubElement(gtrig, 'silentMode').text = str( data.get('silent', False)).lower() diff --git a/tests/jsonparser/fixtures/complete001.xml b/tests/jsonparser/fixtures/complete001.xml index f90b2f59f..506a86968 100644 --- a/tests/jsonparser/fixtures/complete001.xml +++ b/tests/jsonparser/fixtures/complete001.xml @@ -62,6 +62,7 @@ ** + false diff --git a/tests/triggers/fixtures/gerrit001.xml b/tests/triggers/fixtures/gerrit001.xml index d26fe1b7d..5d769f22c 100644 --- a/tests/triggers/fixtures/gerrit001.xml +++ b/tests/triggers/fixtures/gerrit001.xml @@ -19,6 +19,7 @@ subdirectory/** + false diff --git a/tests/triggers/fixtures/gerrit002.xml b/tests/triggers/fixtures/gerrit002.xml index 5ed874188..9e6879007 100644 --- a/tests/triggers/fixtures/gerrit002.xml +++ b/tests/triggers/fixtures/gerrit002.xml @@ -23,6 +23,7 @@ subdirectory/** + false diff --git a/tests/triggers/fixtures/gerrit003.xml b/tests/triggers/fixtures/gerrit003.xml index 30f0bbf3e..8e3549f13 100644 --- a/tests/triggers/fixtures/gerrit003.xml +++ b/tests/triggers/fixtures/gerrit003.xml @@ -19,6 +19,7 @@ subdirectory/** + false PLAIN @@ -39,6 +40,7 @@ subdirectory/** + false diff --git a/tests/triggers/fixtures/gerrit004.xml b/tests/triggers/fixtures/gerrit004.xml index 31e7138ec..d4d78e90a 100644 --- a/tests/triggers/fixtures/gerrit004.xml +++ b/tests/triggers/fixtures/gerrit004.xml @@ -29,6 +29,7 @@ refactor-xy** + false diff --git a/tests/triggers/fixtures/gerrit005.xml b/tests/triggers/fixtures/gerrit005.xml index dfd673114..67ea3c43a 100644 --- a/tests/triggers/fixtures/gerrit005.xml +++ b/tests/triggers/fixtures/gerrit005.xml @@ -19,6 +19,7 @@ subdirectory/** + false diff --git a/tests/triggers/fixtures/gerrit006.xml b/tests/triggers/fixtures/gerrit006.xml index dd41f62c3..ae693508b 100644 --- a/tests/triggers/fixtures/gerrit006.xml +++ b/tests/triggers/fixtures/gerrit006.xml @@ -19,6 +19,7 @@ subdirectory/** + false diff --git a/tests/triggers/fixtures/gerrit007.xml b/tests/triggers/fixtures/gerrit007.xml index e670f5a3b..335094b6e 100644 --- a/tests/triggers/fixtures/gerrit007.xml +++ b/tests/triggers/fixtures/gerrit007.xml @@ -29,6 +29,7 @@ refactor-xy** + false diff --git a/tests/triggers/fixtures/gerrit008.xml b/tests/triggers/fixtures/gerrit008.xml index 35639fdca..4b9342de9 100644 --- a/tests/triggers/fixtures/gerrit008.xml +++ b/tests/triggers/fixtures/gerrit008.xml @@ -35,6 +35,7 @@ refactor-xy** + true diff --git a/tests/triggers/fixtures/gerrit008.yaml b/tests/triggers/fixtures/gerrit008.yaml index fd951afcc..38897f372 100644 --- a/tests/triggers/fixtures/gerrit008.yaml +++ b/tests/triggers/fixtures/gerrit008.yaml @@ -21,6 +21,7 @@ triggers: forbidden-file-paths: - compare-type: ANT pattern: subdirectory/** + disable-strict-forbidden-file-verification: true topics: - compare-type: ANT pattern: refactor-xy** diff --git a/tests/yamlparser/fixtures/complete001.xml b/tests/yamlparser/fixtures/complete001.xml index a30b25aff..a3fabd2a6 100644 --- a/tests/yamlparser/fixtures/complete001.xml +++ b/tests/yamlparser/fixtures/complete001.xml @@ -62,6 +62,7 @@ ** + false