From 08678825a9915ad7b277ccfa83153176127b9e46 Mon Sep 17 00:00:00 2001 From: Eren Atas Date: Mon, 1 Feb 2021 14:18:30 +0100 Subject: [PATCH] Update Gerrit Trigger Plugin Implementation The changes between plugin version 2.30.0-2.32.0 have been implemented. Current test cases are updated, and also new test cases are added in order to verify old version XML output has not been altered. Documentation uses gerrit004.yaml as an exampple, therefore, `build-cancellation-policy` have also been implemented to show as example. Signed-off-by: Eren Atas Change-Id: I55fb6f8dd722d50cff369a6fba0e11c96b0c08aa --- jenkins_jobs/modules/triggers.py | 91 +++++++++++++++++-- tests/jsonparser/fixtures/complete001.json | 10 +- tests/jsonparser/fixtures/complete001.xml | 10 ++ tests/triggers/fixtures/gerrit001.xml | 2 + tests/triggers/fixtures/gerrit001.yaml | 1 + tests/triggers/fixtures/gerrit002.xml | 2 + tests/triggers/fixtures/gerrit003.xml | 2 + tests/triggers/fixtures/gerrit003.yaml | 1 + tests/triggers/fixtures/gerrit004.xml | 9 ++ tests/triggers/fixtures/gerrit004.yaml | 6 ++ tests/triggers/fixtures/gerrit005.xml | 2 + tests/triggers/fixtures/gerrit006.xml | 2 + tests/triggers/fixtures/gerrit006.yaml | 1 + tests/triggers/fixtures/gerrit007.xml | 2 + tests/triggers/fixtures/gerrit007.yaml | 1 + tests/triggers/fixtures/gerrit008.xml | 3 + tests/triggers/fixtures/gerrit008.yaml | 2 + tests/triggers/fixtures/gerrit009.xml | 2 + tests/triggers/fixtures/gerrit010.xml | 2 + ...1-name-and-email-parameter-mode-base64.xml | 2 + ...012-name-and-email-parameter-mode-none.xml | 2 + ...13-name-and-email-parameter-mode-plain.xml | 2 + ...4-commit-message-parameter-mode-base64.xml | 2 + ...15-commit-message-parameter-mode-plain.xml | 2 + ...016-commit-message-parameter-mode-none.xml | 2 + ...7-change-subject-parameter-mode-base64.xml | 2 + ...18-change-subject-parameter-mode-plain.xml | 2 + ...019-change-subject-parameter-mode-none.xml | 2 + ...020-comment-text-parameter-mode-base64.xml | 2 + ...t021-comment-text-parameter-mode-plain.xml | 2 + ...it022-comment-text-parameter-mode-none.xml | 2 + .../gerrit028-trigger-simple-triggers.xml | 3 + .../gerrit028-trigger-simple-triggers.yaml | 1 + ...gerrit029-skip-vote-2.20.plugins_info.yaml | 3 + .../fixtures/gerrit029-skip-vote-2.20.xml | 37 ++++++++ .../fixtures/gerrit029-skip-vote-2.20.yaml | 7 ++ ...0-gerrit-vote-value-2.20.plugins_info.yaml | 3 + .../gerrit030-gerrit-vote-value-2.20.xml | 47 ++++++++++ .../gerrit030-gerrit-vote-value-2.20.yaml | 13 +++ ...it031-gerrit-build-cancellation-policy.xml | 45 +++++++++ ...t031-gerrit-build-cancellation-policy.yaml | 6 ++ ...031-gerrit-messages-2.20.plugins_info.yaml | 3 + .../gerrit032-gerrit-messages-2.20.xml | 39 ++++++++ .../gerrit032-gerrit-messages-2.20.yaml | 7 ++ ...chset-created-event-2.20.plugins_info.yaml | 3 + ...033-gerrit-patchset-created-event-2.20.xml | 45 +++++++++ ...33-gerrit-patchset-created-event-2.20.yaml | 9 ++ tests/yamlparser/fixtures/complete001.xml | 4 + tests/yamlparser/fixtures/complete001.yaml | 3 + tests/yamlparser/fixtures/jinja-yaml01.xml | 2 + 50 files changed, 448 insertions(+), 7 deletions(-) create mode 100644 tests/triggers/fixtures/gerrit029-skip-vote-2.20.plugins_info.yaml create mode 100644 tests/triggers/fixtures/gerrit029-skip-vote-2.20.xml create mode 100644 tests/triggers/fixtures/gerrit029-skip-vote-2.20.yaml create mode 100644 tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.plugins_info.yaml create mode 100644 tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.xml create mode 100644 tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.yaml create mode 100644 tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.xml create mode 100644 tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.yaml create mode 100644 tests/triggers/fixtures/gerrit031-gerrit-messages-2.20.plugins_info.yaml create mode 100644 tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.xml create mode 100644 tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.yaml create mode 100644 tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.plugins_info.yaml create mode 100644 tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.xml create mode 100644 tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.yaml diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index 6985d6605..ec12d9661 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -145,7 +145,7 @@ def gerrit_handle_legacy_configuration(data): ) -def build_gerrit_triggers(xml_parent, data): +def build_gerrit_triggers(xml_parent, data, plugin_ver): available_simple_triggers = { "change-abandoned-event": "PluginChangeAbandonedEvent", "change-merged-event": "PluginChangeMergedEvent", @@ -198,6 +198,15 @@ def build_gerrit_triggers(xml_parent, data): ("exclude-private", "excludePrivateState", False), ("exclude-wip", "excludeWipState", False), ] + if plugin_ver >= pkg_resources.parse_version("2.32.0"): + mapping.append( + ( + "commit-message-contains-regex", + "commitMessageContainsRegEx", + "", + ) + ) + helpers.convert_mapping_to_xml(pc, pce, mapping, fail_required=True) if "comment-added-event" in event.keys(): @@ -225,13 +234,15 @@ def build_gerrit_triggers(xml_parent, data): ).text = comment_added_event["comment-contains-value"] -def build_gerrit_skip_votes(xml_parent, data): +def build_gerrit_skip_votes(xml_parent, data, plugin_ver): outcomes = [ ("successful", "onSuccessful"), ("failed", "onFailed"), ("unstable", "onUnstable"), ("notbuilt", "onNotBuilt"), ] + if plugin_ver >= pkg_resources.parse_version("2.32.0"): + outcomes.append(("aborted", "onAborted")) skip_vote_node = XML.SubElement(xml_parent, "skipVote") skip_vote = data.get("skip-vote", {}) @@ -240,6 +251,26 @@ def build_gerrit_skip_votes(xml_parent, data): XML.SubElement(skip_vote_node, tag_name).text = str(setting).lower() +def build_cancellation_policy(xml_parent, data, plugin_ver): + if plugin_ver >= pkg_resources.parse_version("2.32.0"): + options = [ + ("abort-new-patchsets", "abortNewPatchsets"), + ("abort-manual-patchsets", "abortManualPatchsets"), + ("abort-same-topic", "abortSameTopic"), + ] + + build_cancellation_policy_node = XML.SubElement( + xml_parent, "buildCancellationPolicy" + ) + build_cancellation_policy_object = data.get("build-cancellation-policy", {}) + XML.SubElement(build_cancellation_policy_node, "enabled").text = "true" + for tag, tag_name in options: + setting = build_cancellation_policy_object.get(tag, False) + XML.SubElement(build_cancellation_policy_node, tag_name).text = str( + setting + ).lower() + + def build_gerrit_parameter_modes(xml_parent, data, plugin_ver): if plugin_ver < pkg_resources.parse_version("2.18.0"): for parameter_name in ( @@ -330,6 +361,9 @@ def gerrit(registry, xml_parent, data): (default false) * **exclude-wip** (`bool`) -- exclude wip change (default false) + * **commit-message-contains-regex** (`str`) -- Commit message + contains regular expression. (default '') + Requires Gerrit Trigger Plugin >= 2.32.0 exclude-private|exclude-wip needs Gerrit Trigger v2.29.0 @@ -418,6 +452,8 @@ def gerrit(registry, xml_parent, data): :arg int gerrit-build-unstable-verified-value: Unstable ''Verified'' value :arg int gerrit-build-notbuilt-verified-value: Not built ''Verified'' value + :arg int gerrit-build-aborted-verified-value: Aborted ''Verified'' value + Requires Gerrit Trigger Plugin version >= 2.31.0 :arg int gerrit-build-started-codereview-value: Started ''CodeReview'' value :arg int gerrit-build-successful-codereview-value: Successful @@ -427,10 +463,14 @@ def gerrit(registry, xml_parent, data): value :arg int gerrit-build-notbuilt-codereview-value: Not built ''CodeReview'' value + :arg int gerrit-build-aborted-codereview-value: Aborted ''CodeReview'' + value + Requires Gerrit Trigger Plugin version >= 2.31.0 :arg str failure-message: Message to leave on failure (default '') :arg str successful-message: Message to leave on success (default '') :arg str unstable-message: Message to leave when unstable (default '') :arg str notbuilt-message: Message to leave when not built (default '') + :arg str aborted-message: Message to leave when aborted (default '') :arg str failure-message-file: Sets the filename within the workspace from which to retrieve the unsuccessful review message. (optional) :arg list projects: list of projects to match @@ -500,6 +540,7 @@ def gerrit(registry, xml_parent, data): * **failed** (`bool`) * **unstable** (`bool`) * **notbuilt** (`bool`) + * **aborted** (`bool`) -- Requires Gerrit Trigger Plugin version >= 2.31.0 :arg bool silent: When silent mode is on there will be no communication back to Gerrit, i.e. no build started/failed/successful approve @@ -511,6 +552,23 @@ def gerrit(registry, xml_parent, data): to Gerrit. (default false) :arg bool escape-quotes: escape quotes in the values of Gerrit change parameters (default true) + :arg dict build-cancellation-policy: If used, rules regarding + cancellation of builds can be set with this option when + patchsets of the same change comes in. This setting overrides global + server configuration. If build-cancellation-policy is not present in + YAML the global server configuration is used. + Requires Gerrit Trigger Plugin version >= 2.32.0 + + :Options: * **abort-new-patchsets** (`bool`) -- Only running jobs + will be cancelled if a new patch version is pushed over + (default false). + * **abort-manual-patchsets** (`bool`) -- Builds triggered + manually will be aborted when a new patch set arrives + (default false). + * **abort-same-topic** (`bool`) -- Builds triggered with + topic will be aborted when a new patch set with the + same topic arrives (default false). + :arg bool no-name-and-email: Do not pass compound 'name and email' parameters (default false) @@ -709,7 +767,9 @@ def gerrit(registry, xml_parent, data): project.get("disable-strict-forbidden-file-verification", False) ).lower() - build_gerrit_skip_votes(gtrig, data) + build_gerrit_skip_votes(gtrig, data, plugin_ver) + if "build-cancellation-policy" in data: + build_cancellation_policy(gtrig, data, plugin_ver) general_mappings = [ ("silent", "silentMode", False), ("silent-start", "silentStartMode", False), @@ -750,10 +810,10 @@ def gerrit(registry, xml_parent, data): "Gerrit Trigger property 'trigger-for-unreviewed-patches' is not " "supported in this plugin version" ) - build_gerrit_triggers(gtrig, data) + build_gerrit_triggers(gtrig, data, plugin_ver) override = str(data.get("override-votes", False)).lower() if override == "true": - for yamlkey, xmlkey in [ + votes = [ ("gerrit-build-started-verified-value", "gerritBuildStartedVerifiedValue"), ( "gerrit-build-successful-verified-value", @@ -788,7 +848,23 @@ def gerrit(registry, xml_parent, data): "gerrit-build-notbuilt-codereview-value", "gerritBuildNotBuiltCodeReviewValue", ), - ]: + ] + + if plugin_ver >= pkg_resources.parse_version("2.31.0"): + votes.append( + ( + "gerrit-build-aborted-verified-value", + "gerritBuildAbortedVerifiedValue", + ) + ) + votes.append( + ( + "gerrit-build-aborted-codereview-value", + "gerritBuildAbortedCodeReviewValue", + ) + ) + + for yamlkey, xmlkey in votes: if data.get(yamlkey) is not None: # str(int(x)) makes input values like '+1' work XML.SubElement(gtrig, xmlkey).text = str(int(data.get(yamlkey))) @@ -802,6 +878,9 @@ def gerrit(registry, xml_parent, data): ("custom-url", "customUrl", ""), ("server-name", "serverName", "__ANY__"), ] + if plugin_ver >= pkg_resources.parse_version("2.31.0"): + message_mappings.append(("aborted-message", "buildAbortedMessage", "")) + helpers.convert_mapping_to_xml(gtrig, data, message_mappings, fail_required=True) diff --git a/tests/jsonparser/fixtures/complete001.json b/tests/jsonparser/fixtures/complete001.json index cbe314f06..5bfc00608 100644 --- a/tests/jsonparser/fixtures/complete001.json +++ b/tests/jsonparser/fixtures/complete001.json @@ -74,6 +74,11 @@ "trigger-on-ref-updated-event": false, "trigger-on-comment-added-event": false, "override-votes": true, + "build-cancellation-policy": { + "abort-new-patchsets": true, + "abort-manual-patchsets": false, + "abort-same-topic": true + }, "gerrit-build-started-verified-value": 0, "gerrit-build-successful-verified-value": 1, "gerrit-build-failed-verified-value": -1, @@ -84,6 +89,8 @@ "gerrit-build-failed-codereview-value": -1, "gerrit-build-unstable-codereview-value": -1, "gerrit-build-notbuilt-codereview-value": -1, + "gerrit-build-aborted-verified-value": 0, + "gerrit-build-aborted-codereview-value": 0, "projects": [ { "project-compare-type": "PLAIN", @@ -100,7 +107,8 @@ "failure-message": "Failed message.", "successful-message": "Success message.", "unstable-message": "Unstable message.", - "notbuilt-message": "Not built message." + "notbuilt-message": "Not built message.", + "aborted-message": "Aborted message." } } ] diff --git a/tests/jsonparser/fixtures/complete001.xml b/tests/jsonparser/fixtures/complete001.xml index 5b328eb1b..1e00b88df 100644 --- a/tests/jsonparser/fixtures/complete001.xml +++ b/tests/jsonparser/fixtures/complete001.xml @@ -65,7 +65,14 @@ false false false + false + + true + true + false + true + false false true @@ -92,6 +99,8 @@ -1 -1 -1 + 0 + 0 Start message. Failed message. Success message. @@ -100,6 +109,7 @@ __ANY__ + Aborted message. diff --git a/tests/triggers/fixtures/gerrit001.xml b/tests/triggers/fixtures/gerrit001.xml index 00774f200..fc04a48d8 100644 --- a/tests/triggers/fixtures/gerrit001.xml +++ b/tests/triggers/fixtures/gerrit001.xml @@ -27,6 +27,7 @@ true true true + true false false @@ -54,6 +55,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit001.yaml b/tests/triggers/fixtures/gerrit001.yaml index 88f62c3cb..8ee250c89 100644 --- a/tests/triggers/fixtures/gerrit001.yaml +++ b/tests/triggers/fixtures/gerrit001.yaml @@ -16,6 +16,7 @@ triggers: failed: true unstable: true notbuilt: true + aborted: true silent: false escape-quotes: false no-name-and-email: false diff --git a/tests/triggers/fixtures/gerrit002.xml b/tests/triggers/fixtures/gerrit002.xml index f18e4fd77..1a5823bd5 100644 --- a/tests/triggers/fixtures/gerrit002.xml +++ b/tests/triggers/fixtures/gerrit002.xml @@ -31,6 +31,7 @@ true true true + false false false @@ -58,6 +59,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit003.xml b/tests/triggers/fixtures/gerrit003.xml index 32d55b85e..24ea168e7 100644 --- a/tests/triggers/fixtures/gerrit003.xml +++ b/tests/triggers/fixtures/gerrit003.xml @@ -48,6 +48,7 @@ true true true + true false false @@ -75,6 +76,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit003.yaml b/tests/triggers/fixtures/gerrit003.yaml index 5e347e7d4..caf53bc4f 100644 --- a/tests/triggers/fixtures/gerrit003.yaml +++ b/tests/triggers/fixtures/gerrit003.yaml @@ -26,6 +26,7 @@ triggers: failed: true unstable: true notbuilt: true + aborted: true silent: false escape-quotes: false no-name-and-email: false diff --git a/tests/triggers/fixtures/gerrit004.xml b/tests/triggers/fixtures/gerrit004.xml index b7c5dd8b1..273fc7bc7 100644 --- a/tests/triggers/fixtures/gerrit004.xml +++ b/tests/triggers/fixtures/gerrit004.xml @@ -37,7 +37,14 @@ true true true + true + + true + false + true + true + false true false @@ -57,6 +64,7 @@ true true true + regex APRV @@ -71,6 +79,7 @@ path/to/filename my-server + diff --git a/tests/triggers/fixtures/gerrit004.yaml b/tests/triggers/fixtures/gerrit004.yaml index d890d57f0..51461d56b 100644 --- a/tests/triggers/fixtures/gerrit004.yaml +++ b/tests/triggers/fixtures/gerrit004.yaml @@ -7,6 +7,7 @@ triggers: exclude-no-code-change: true exclude-private: true exclude-wip: true + commit-message-contains-regex: "regex" - comment-added-event: approval-category: 'APRV' approval-value: 1 @@ -29,6 +30,11 @@ triggers: failed: true unstable: true notbuilt: true + aborted: true + build-cancellation-policy: + abort-new-patchsets: false + abort-manual-patchsets: true + abort-same-topic: true silent: false silent-start: true escape-quotes: false diff --git a/tests/triggers/fixtures/gerrit005.xml b/tests/triggers/fixtures/gerrit005.xml index 05a179daf..06bf167c6 100644 --- a/tests/triggers/fixtures/gerrit005.xml +++ b/tests/triggers/fixtures/gerrit005.xml @@ -27,6 +27,7 @@ false false false + false false false @@ -56,6 +57,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit006.xml b/tests/triggers/fixtures/gerrit006.xml index 26ecccee1..10744aa92 100644 --- a/tests/triggers/fixtures/gerrit006.xml +++ b/tests/triggers/fixtures/gerrit006.xml @@ -27,6 +27,7 @@ true true true + true false false @@ -53,6 +54,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit006.yaml b/tests/triggers/fixtures/gerrit006.yaml index c5db411b9..5ed085ae2 100644 --- a/tests/triggers/fixtures/gerrit006.yaml +++ b/tests/triggers/fixtures/gerrit006.yaml @@ -16,6 +16,7 @@ triggers: failed: true unstable: true notbuilt: true + aborted: true silent: false escape-quotes: false no-name-and-email: false diff --git a/tests/triggers/fixtures/gerrit007.xml b/tests/triggers/fixtures/gerrit007.xml index 8c673fd06..ac280dc52 100644 --- a/tests/triggers/fixtures/gerrit007.xml +++ b/tests/triggers/fixtures/gerrit007.xml @@ -37,6 +37,7 @@ true true true + true false false @@ -65,6 +66,7 @@ my-server + diff --git a/tests/triggers/fixtures/gerrit007.yaml b/tests/triggers/fixtures/gerrit007.yaml index 84a45ce9c..889038b24 100644 --- a/tests/triggers/fixtures/gerrit007.yaml +++ b/tests/triggers/fixtures/gerrit007.yaml @@ -24,6 +24,7 @@ triggers: failed: true unstable: true notbuilt: true + aborted: true silent: false escape-quotes: false no-name-and-email: false diff --git a/tests/triggers/fixtures/gerrit008.xml b/tests/triggers/fixtures/gerrit008.xml index 2639bd702..1e64860ad 100644 --- a/tests/triggers/fixtures/gerrit008.xml +++ b/tests/triggers/fixtures/gerrit008.xml @@ -43,6 +43,7 @@ true true true + true false true @@ -63,6 +64,7 @@ true true true + regex APRV @@ -77,6 +79,7 @@ path/to/filename my-server + diff --git a/tests/triggers/fixtures/gerrit008.yaml b/tests/triggers/fixtures/gerrit008.yaml index 48fcc0b2a..d8b7ee9c0 100644 --- a/tests/triggers/fixtures/gerrit008.yaml +++ b/tests/triggers/fixtures/gerrit008.yaml @@ -7,6 +7,7 @@ triggers: exclude-no-code-change: true exclude-private: true exclude-wip: true + commit-message-contains-regex: regex - comment-added-event: approval-category: 'APRV' approval-value: 1 @@ -32,6 +33,7 @@ triggers: failed: true unstable: true notbuilt: true + aborted: true silent: false silent-start: true escape-quotes: false diff --git a/tests/triggers/fixtures/gerrit009.xml b/tests/triggers/fixtures/gerrit009.xml index cc87f5e25..264ce6f16 100644 --- a/tests/triggers/fixtures/gerrit009.xml +++ b/tests/triggers/fixtures/gerrit009.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -37,6 +38,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit010.xml b/tests/triggers/fixtures/gerrit010.xml index 78d66b4a4..f310dd960 100644 --- a/tests/triggers/fixtures/gerrit010.xml +++ b/tests/triggers/fixtures/gerrit010.xml @@ -27,6 +27,7 @@ false false false + false false false @@ -54,6 +55,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit011-name-and-email-parameter-mode-base64.xml b/tests/triggers/fixtures/gerrit011-name-and-email-parameter-mode-base64.xml index a52b428ee..6b915a9f2 100644 --- a/tests/triggers/fixtures/gerrit011-name-and-email-parameter-mode-base64.xml +++ b/tests/triggers/fixtures/gerrit011-name-and-email-parameter-mode-base64.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit012-name-and-email-parameter-mode-none.xml b/tests/triggers/fixtures/gerrit012-name-and-email-parameter-mode-none.xml index 3e5af26fa..23f906e1d 100644 --- a/tests/triggers/fixtures/gerrit012-name-and-email-parameter-mode-none.xml +++ b/tests/triggers/fixtures/gerrit012-name-and-email-parameter-mode-none.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit013-name-and-email-parameter-mode-plain.xml b/tests/triggers/fixtures/gerrit013-name-and-email-parameter-mode-plain.xml index 168ecdb6a..8d940e627 100644 --- a/tests/triggers/fixtures/gerrit013-name-and-email-parameter-mode-plain.xml +++ b/tests/triggers/fixtures/gerrit013-name-and-email-parameter-mode-plain.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit014-commit-message-parameter-mode-base64.xml b/tests/triggers/fixtures/gerrit014-commit-message-parameter-mode-base64.xml index 168ecdb6a..8d940e627 100644 --- a/tests/triggers/fixtures/gerrit014-commit-message-parameter-mode-base64.xml +++ b/tests/triggers/fixtures/gerrit014-commit-message-parameter-mode-base64.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit015-commit-message-parameter-mode-plain.xml b/tests/triggers/fixtures/gerrit015-commit-message-parameter-mode-plain.xml index aca3e5b3e..39b40c10e 100644 --- a/tests/triggers/fixtures/gerrit015-commit-message-parameter-mode-plain.xml +++ b/tests/triggers/fixtures/gerrit015-commit-message-parameter-mode-plain.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit016-commit-message-parameter-mode-none.xml b/tests/triggers/fixtures/gerrit016-commit-message-parameter-mode-none.xml index 585b758a0..f006c65cb 100644 --- a/tests/triggers/fixtures/gerrit016-commit-message-parameter-mode-none.xml +++ b/tests/triggers/fixtures/gerrit016-commit-message-parameter-mode-none.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit017-change-subject-parameter-mode-base64.xml b/tests/triggers/fixtures/gerrit017-change-subject-parameter-mode-base64.xml index afb1fc2e5..3a6b08617 100644 --- a/tests/triggers/fixtures/gerrit017-change-subject-parameter-mode-base64.xml +++ b/tests/triggers/fixtures/gerrit017-change-subject-parameter-mode-base64.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit018-change-subject-parameter-mode-plain.xml b/tests/triggers/fixtures/gerrit018-change-subject-parameter-mode-plain.xml index 168ecdb6a..8d940e627 100644 --- a/tests/triggers/fixtures/gerrit018-change-subject-parameter-mode-plain.xml +++ b/tests/triggers/fixtures/gerrit018-change-subject-parameter-mode-plain.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit019-change-subject-parameter-mode-none.xml b/tests/triggers/fixtures/gerrit019-change-subject-parameter-mode-none.xml index 06483bd25..df7fba42c 100644 --- a/tests/triggers/fixtures/gerrit019-change-subject-parameter-mode-none.xml +++ b/tests/triggers/fixtures/gerrit019-change-subject-parameter-mode-none.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit020-comment-text-parameter-mode-base64.xml b/tests/triggers/fixtures/gerrit020-comment-text-parameter-mode-base64.xml index 168ecdb6a..8d940e627 100644 --- a/tests/triggers/fixtures/gerrit020-comment-text-parameter-mode-base64.xml +++ b/tests/triggers/fixtures/gerrit020-comment-text-parameter-mode-base64.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit021-comment-text-parameter-mode-plain.xml b/tests/triggers/fixtures/gerrit021-comment-text-parameter-mode-plain.xml index 25b079f32..69f6eea57 100644 --- a/tests/triggers/fixtures/gerrit021-comment-text-parameter-mode-plain.xml +++ b/tests/triggers/fixtures/gerrit021-comment-text-parameter-mode-plain.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit022-comment-text-parameter-mode-none.xml b/tests/triggers/fixtures/gerrit022-comment-text-parameter-mode-none.xml index 22a02bd25..df4cb480c 100644 --- a/tests/triggers/fixtures/gerrit022-comment-text-parameter-mode-none.xml +++ b/tests/triggers/fixtures/gerrit022-comment-text-parameter-mode-none.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -32,6 +33,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.xml b/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.xml index b5dfea0b5..a8eb1b80d 100644 --- a/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.xml +++ b/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.xml @@ -9,6 +9,7 @@ false false false + false false false @@ -45,6 +46,7 @@ true false true + regex @@ -59,6 +61,7 @@ __ANY__ + diff --git a/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.yaml b/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.yaml index 0fd18c0a5..eb9331077 100644 --- a/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.yaml +++ b/tests/triggers/fixtures/gerrit028-trigger-simple-triggers.yaml @@ -19,6 +19,7 @@ triggers: exclude-private: false exclude-trivial-rebase: false exclude-wip: true + commit-message-contains-regex: regex - private-state-changed-event - ref-updated-event - topic-changed-event diff --git a/tests/triggers/fixtures/gerrit029-skip-vote-2.20.plugins_info.yaml b/tests/triggers/fixtures/gerrit029-skip-vote-2.20.plugins_info.yaml new file mode 100644 index 000000000..28d5bef90 --- /dev/null +++ b/tests/triggers/fixtures/gerrit029-skip-vote-2.20.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'Gerrit Trigger' + shortName: 'gerrit-trigger' + version: '2.20.0' diff --git a/tests/triggers/fixtures/gerrit029-skip-vote-2.20.xml b/tests/triggers/fixtures/gerrit029-skip-vote-2.20.xml new file mode 100644 index 000000000..dc34aac19 --- /dev/null +++ b/tests/triggers/fixtures/gerrit029-skip-vote-2.20.xml @@ -0,0 +1,37 @@ + + + + + + + + true + true + true + true + + false + false + true + + BASE64 + PLAIN + PLAIN + BASE64 + + false + + + + + + + + + + + + __ANY__ + + + diff --git a/tests/triggers/fixtures/gerrit029-skip-vote-2.20.yaml b/tests/triggers/fixtures/gerrit029-skip-vote-2.20.yaml new file mode 100644 index 000000000..1547d3cf7 --- /dev/null +++ b/tests/triggers/fixtures/gerrit029-skip-vote-2.20.yaml @@ -0,0 +1,7 @@ +triggers: + - gerrit: + skip-vote: + successful: true + failed: true + unstable: true + notbuilt: true diff --git a/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.plugins_info.yaml b/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.plugins_info.yaml new file mode 100644 index 000000000..28d5bef90 --- /dev/null +++ b/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'Gerrit Trigger' + shortName: 'gerrit-trigger' + version: '2.20.0' diff --git a/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.xml b/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.xml new file mode 100644 index 000000000..661cb7bf7 --- /dev/null +++ b/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.xml @@ -0,0 +1,47 @@ + + + + + + + + false + false + false + false + + false + false + true + + BASE64 + PLAIN + PLAIN + BASE64 + + false + + + + + 0 + 1 + -1 + -1 + -1 + 0 + 1 + -1 + -1 + -1 + + + + + + + + __ANY__ + + + diff --git a/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.yaml b/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.yaml new file mode 100644 index 000000000..971dc7981 --- /dev/null +++ b/tests/triggers/fixtures/gerrit030-gerrit-vote-value-2.20.yaml @@ -0,0 +1,13 @@ +triggers: + - gerrit: + override-votes: true + gerrit-build-started-verified-value: 0 + gerrit-build-successful-verified-value: 1 + gerrit-build-failed-verified-value: -1 + gerrit-build-unstable-verified-value: -1 + gerrit-build-notbuilt-verified-value: -1 + gerrit-build-started-codereview-value: 0 + gerrit-build-successful-codereview-value: 1 + gerrit-build-failed-codereview-value: -1 + gerrit-build-unstable-codereview-value: -1 + gerrit-build-notbuilt-codereview-value: -1 diff --git a/tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.xml b/tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.xml new file mode 100644 index 000000000..4bb89e0d4 --- /dev/null +++ b/tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.xml @@ -0,0 +1,45 @@ + + + + + + + + false + false + false + false + false + + + true + false + true + true + + false + false + true + + BASE64 + PLAIN + PLAIN + BASE64 + + false + + + + + + + + + + + + __ANY__ + + + + diff --git a/tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.yaml b/tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.yaml new file mode 100644 index 000000000..a14150d9e --- /dev/null +++ b/tests/triggers/fixtures/gerrit031-gerrit-build-cancellation-policy.yaml @@ -0,0 +1,6 @@ +triggers: + - gerrit: + build-cancellation-policy: + abort-new-patchsets: false + abort-manual-patchsets: true + abort-same-topic: true diff --git a/tests/triggers/fixtures/gerrit031-gerrit-messages-2.20.plugins_info.yaml b/tests/triggers/fixtures/gerrit031-gerrit-messages-2.20.plugins_info.yaml new file mode 100644 index 000000000..28d5bef90 --- /dev/null +++ b/tests/triggers/fixtures/gerrit031-gerrit-messages-2.20.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'Gerrit Trigger' + shortName: 'gerrit-trigger' + version: '2.20.0' diff --git a/tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.xml b/tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.xml new file mode 100644 index 000000000..d4029b45d --- /dev/null +++ b/tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.xml @@ -0,0 +1,39 @@ + + + + + + + + false + false + false + false + false + + false + false + true + + BASE64 + PLAIN + PLAIN + BASE64 + + false + + + + + Start message. + Failed message. + Success message. + Unstable message. + Not built message. + + + __ANY__ + + + + diff --git a/tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.yaml b/tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.yaml new file mode 100644 index 000000000..e962fe457 --- /dev/null +++ b/tests/triggers/fixtures/gerrit032-gerrit-messages-2.20.yaml @@ -0,0 +1,7 @@ +triggers: + - gerrit: + start-message: 'Start message.' + failure-message: 'Failed message.' + successful-message: 'Success message.' + unstable-message: 'Unstable message.' + notbuilt-message: 'Not built message.' diff --git a/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.plugins_info.yaml b/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.plugins_info.yaml new file mode 100644 index 000000000..28d5bef90 --- /dev/null +++ b/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'Gerrit Trigger' + shortName: 'gerrit-trigger' + version: '2.20.0' diff --git a/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.xml b/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.xml new file mode 100644 index 000000000..d68c21de5 --- /dev/null +++ b/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.xml @@ -0,0 +1,45 @@ + + + + + + + + false + false + false + false + + false + false + true + + BASE64 + PLAIN + PLAIN + BASE64 + + false + + + + + + true + true + true + true + true + + + + + + + + + + __ANY__ + + + diff --git a/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.yaml b/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.yaml new file mode 100644 index 000000000..0715a1c45 --- /dev/null +++ b/tests/triggers/fixtures/gerrit033-gerrit-patchset-created-event-2.20.yaml @@ -0,0 +1,9 @@ +triggers: + - gerrit: + trigger-on: + - patchset-created-event: + exclude-drafts: true + exclude-trivial-rebase: true + exclude-no-code-change: true + exclude-private: true + exclude-wip: true diff --git a/tests/yamlparser/fixtures/complete001.xml b/tests/yamlparser/fixtures/complete001.xml index 75eeff252..92cef9bd1 100644 --- a/tests/yamlparser/fixtures/complete001.xml +++ b/tests/yamlparser/fixtures/complete001.xml @@ -66,6 +66,7 @@ false false false + false false false @@ -93,6 +94,8 @@ -1 -1 -1 + 0 + 0 Start message. Failed message. Success message. @@ -101,6 +104,7 @@ __ANY__ + Aborted message. diff --git a/tests/yamlparser/fixtures/complete001.yaml b/tests/yamlparser/fixtures/complete001.yaml index 0342819a0..35b54da46 100644 --- a/tests/yamlparser/fixtures/complete001.yaml +++ b/tests/yamlparser/fixtures/complete001.yaml @@ -59,6 +59,8 @@ gerrit-build-failed-codereview-value: -1 gerrit-build-unstable-codereview-value: -1 gerrit-build-notbuilt-codereview-value: -1 + gerrit-build-aborted-verified-value: 0 + gerrit-build-aborted-codereview-value: 0 projects: - project-compare-type: 'PLAIN' project-pattern: '{project_pattern}' @@ -70,6 +72,7 @@ successful-message: 'Success message.' unstable-message: 'Unstable message.' notbuilt-message: 'Not built message.' + aborted-message: 'Aborted message.' - scm: name: gerrit-scm diff --git a/tests/yamlparser/fixtures/jinja-yaml01.xml b/tests/yamlparser/fixtures/jinja-yaml01.xml index ec26a8078..61998df16 100644 --- a/tests/yamlparser/fixtures/jinja-yaml01.xml +++ b/tests/yamlparser/fixtures/jinja-yaml01.xml @@ -41,6 +41,7 @@ false false false + false false false @@ -64,6 +65,7 @@ __ANY__ +