diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index b8f5d3110..4c0c4c249 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -993,11 +993,25 @@ def github_pull_request(registry, xml_parent, data): (optional) :arg bool cancel-builds-on-update: cancel existing builds when a PR is updated (optional) + :arg list included-regions: Each inclusion uses regular expression pattern + matching, and must be separated by a new line. An empty list implies + that everything is included. (optional) + :arg list excluded-regions: Each exclusion uses regular expression pattern + matching, and must be separated by a new line. Exclusions take + precedence over inclusions, if there is an overlap between included + and excluded regions. (optional) - Example: + Full Example: - .. literalinclude:: /../../tests/triggers/fixtures/github-pull-request.yaml + .. literalinclude:: + /../../tests/triggers/fixtures/github-pull-request-full.yaml + :language: yaml + Minimal Example: + + .. literalinclude:: + /../../tests/triggers/fixtures/github-pull-request-minimal.yaml + :language: yaml """ ghprb = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.ghprb.' 'GhprbTrigger') @@ -1015,6 +1029,10 @@ def github_pull_request(registry, xml_parent, data): black_list_labels_string = "\n".join(data.get('black-list-labels', [])) XML.SubElement(ghprb, 'blackListLabels').text = black_list_labels_string XML.SubElement(ghprb, 'cron').text = data.get('cron', '') + excluded_regions_string = "\n".join(data.get('excluded-regions', [])) + XML.SubElement(ghprb, 'excludedRegions').text = excluded_regions_string + included_regions_string = "\n".join(data.get('included-regions', [])) + XML.SubElement(ghprb, 'includedRegions').text = included_regions_string build_desc_template = data.get('build-desc-template', '') if build_desc_template: diff --git a/tests/triggers/fixtures/github-pull-request-comments.xml b/tests/triggers/fixtures/github-pull-request-comments.xml index 6c511897d..76683abdd 100644 --- a/tests/triggers/fixtures/github-pull-request-comments.xml +++ b/tests/triggers/fixtures/github-pull-request-comments.xml @@ -13,6 +13,8 @@ org2 * * * * * + + retest this please true diff --git a/tests/triggers/fixtures/github-pull-request-full.xml b/tests/triggers/fixtures/github-pull-request-full.xml new file mode 100644 index 000000000..8448a5398 --- /dev/null +++ b/tests/triggers/fixtures/github-pull-request-full.xml @@ -0,0 +1,80 @@ + + + + + * * * * * + user1 +user2 + true + user3 +user4 + org1 +org2 + label1 +label2 + label3 +label4 + * * * * * + exclude +region + include +region + build description + retest this please + no tests + true + true + true + false + + + master + + + testing + + + 123-456-789 + + + status context + triggered status message + started + url/to/status + test result with status message + + + success message + SUCCESS + + + failure message + FAILURE + + + error message + ERROR + + + + + + + success comment + SUCCESS + + + failure comment + FAILURE + + + error-comment + ERROR + + + + + + + + diff --git a/tests/triggers/fixtures/github-pull-request.yaml b/tests/triggers/fixtures/github-pull-request-full.yaml similarity index 51% rename from tests/triggers/fixtures/github-pull-request.yaml rename to tests/triggers/fixtures/github-pull-request-full.yaml index 58de03dcf..af50156fa 100644 --- a/tests/triggers/fixtures/github-pull-request.yaml +++ b/tests/triggers/fixtures/github-pull-request-full.yaml @@ -21,10 +21,28 @@ triggers: skip-build-phrase: 'no tests' only-trigger-phrase: true github-hooks: true - permit-all: false + permit-all: true auto-close-on-fail: false allow-whitelist-orgs-as-admins: true white-list-target-branches: - master - testing auth-id: '123-456-789' + status-context: "status context" + triggered-status: "triggered status message" + started-status: "started" + status-url: "url/to/status" + status-add-test-results: "test result with status message" + success-status: "success message" + failure-status: "failure message" + error-status: "error message" + success-comment: "success comment" + failure-comment: "failure comment" + error-comment: "error-comment" + cancel-builds-on-update: true + included-regions: + - include + - region + excluded-regions: + - exclude + - region diff --git a/tests/triggers/fixtures/github-pull-request-minimal.xml b/tests/triggers/fixtures/github-pull-request-minimal.xml new file mode 100644 index 000000000..755b16d49 --- /dev/null +++ b/tests/triggers/fixtures/github-pull-request-minimal.xml @@ -0,0 +1,23 @@ + + + + + + + false + + + + + + + + + + false + false + false + false + + + diff --git a/tests/triggers/fixtures/github-pull-request-minimal.yaml b/tests/triggers/fixtures/github-pull-request-minimal.yaml new file mode 100644 index 000000000..6640ed4be --- /dev/null +++ b/tests/triggers/fixtures/github-pull-request-minimal.yaml @@ -0,0 +1,2 @@ +triggers: + - github-pull-request diff --git a/tests/triggers/fixtures/github-pull-request-multiple-extensions.xml b/tests/triggers/fixtures/github-pull-request-multiple-extensions.xml index fc7341eec..35f517a06 100644 --- a/tests/triggers/fixtures/github-pull-request-multiple-extensions.xml +++ b/tests/triggers/fixtures/github-pull-request-multiple-extensions.xml @@ -13,6 +13,8 @@ org2 * * * * * + + retest this please true diff --git a/tests/triggers/fixtures/github-pull-request-status.xml b/tests/triggers/fixtures/github-pull-request-status.xml index a188838a0..f499478dc 100644 --- a/tests/triggers/fixtures/github-pull-request-status.xml +++ b/tests/triggers/fixtures/github-pull-request-status.xml @@ -13,6 +13,8 @@ org2 * * * * * + + retest this please true diff --git a/tests/triggers/fixtures/github-pull-request.xml b/tests/triggers/fixtures/github-pull-request.xml deleted file mode 100644 index c1222320e..000000000 --- a/tests/triggers/fixtures/github-pull-request.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - * * * * * - user1 -user2 - true - user3 -user4 - org1 -org2 - label1 -label2 - label3 -label4 - * * * * * - build description - retest this please - no tests - true - true - false - false - - - master - - - testing - - - 123-456-789 - - -