Merge "Add support for setting file paths to trigger on"

This commit is contained in:
Zuul 2018-05-25 05:26:38 +00:00 committed by Gerrit Code Review
commit 2f0f0f0caf
9 changed files with 150 additions and 39 deletions

View File

@ -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:

View File

@ -13,6 +13,8 @@ org2</orgslist>
<whiteListLabels/>
<blackListLabels/>
<cron>* * * * *</cron>
<excludedRegions/>
<includedRegions/>
<triggerPhrase>retest this please</triggerPhrase>
<skipBuildPhrase/>
<onlyTriggerPhrase>true</onlyTriggerPhrase>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<triggers class="vector">
<org.jenkinsci.plugins.ghprb.GhprbTrigger>
<spec>* * * * *</spec>
<adminlist>user1
user2</adminlist>
<allowMembersOfWhitelistedOrgsAsAdmin>true</allowMembersOfWhitelistedOrgsAsAdmin>
<whitelist>user3
user4</whitelist>
<orgslist>org1
org2</orgslist>
<whiteListLabels>label1
label2</whiteListLabels>
<blackListLabels>label3
label4</blackListLabels>
<cron>* * * * *</cron>
<excludedRegions>exclude
region</excludedRegions>
<includedRegions>include
region</includedRegions>
<buildDescTemplate>build description</buildDescTemplate>
<triggerPhrase>retest this please</triggerPhrase>
<skipBuildPhrase>no tests</skipBuildPhrase>
<onlyTriggerPhrase>true</onlyTriggerPhrase>
<useGitHubHooks>true</useGitHubHooks>
<permitAll>true</permitAll>
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
<whiteListTargetBranches>
<org.jenkinsci.plugins.ghprb.GhprbBranch>
<branch>master</branch>
</org.jenkinsci.plugins.ghprb.GhprbBranch>
<org.jenkinsci.plugins.ghprb.GhprbBranch>
<branch>testing</branch>
</org.jenkinsci.plugins.ghprb.GhprbBranch>
</whiteListTargetBranches>
<gitHubAuthId>123-456-789</gitHubAuthId>
<extensions>
<org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
<commitStatusContext>status context</commitStatusContext>
<triggeredStatus>triggered status message</triggeredStatus>
<startedStatus>started</startedStatus>
<statusUrl>url/to/status</statusUrl>
<addTestResults>test result with status message</addTestResults>
<completedStatus>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<message>success message</message>
<result>SUCCESS</result>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<message>failure message</message>
<result>FAILURE</result>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<message>error message</message>
<result>ERROR</result>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
</completedStatus>
</org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildStatus>
<messages>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<message>success comment</message>
<result>SUCCESS</result>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<message>failure comment</message>
<result>FAILURE</result>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
<message>error-comment</message>
<result>ERROR</result>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage>
</messages>
</org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildStatus>
<org.jenkinsci.plugins.ghprb.extensions.build.GhprbCancelBuildsOnUpdate/>
</extensions>
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
</triggers>
</project>

View File

@ -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

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<triggers class="vector">
<org.jenkinsci.plugins.ghprb.GhprbTrigger>
<spec/>
<adminlist/>
<allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
<whitelist/>
<orgslist/>
<whiteListLabels/>
<blackListLabels/>
<cron/>
<excludedRegions/>
<includedRegions/>
<triggerPhrase/>
<skipBuildPhrase/>
<onlyTriggerPhrase>false</onlyTriggerPhrase>
<useGitHubHooks>false</useGitHubHooks>
<permitAll>false</permitAll>
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
</triggers>
</project>

View File

@ -0,0 +1,2 @@
triggers:
- github-pull-request

View File

@ -13,6 +13,8 @@ org2</orgslist>
<whiteListLabels/>
<blackListLabels/>
<cron>* * * * *</cron>
<excludedRegions/>
<includedRegions/>
<triggerPhrase>retest this please</triggerPhrase>
<skipBuildPhrase/>
<onlyTriggerPhrase>true</onlyTriggerPhrase>

View File

@ -13,6 +13,8 @@ org2</orgslist>
<whiteListLabels/>
<blackListLabels/>
<cron>* * * * *</cron>
<excludedRegions/>
<includedRegions/>
<triggerPhrase>retest this please</triggerPhrase>
<skipBuildPhrase/>
<onlyTriggerPhrase>true</onlyTriggerPhrase>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<triggers class="vector">
<org.jenkinsci.plugins.ghprb.GhprbTrigger>
<spec>* * * * *</spec>
<adminlist>user1
user2</adminlist>
<allowMembersOfWhitelistedOrgsAsAdmin>true</allowMembersOfWhitelistedOrgsAsAdmin>
<whitelist>user3
user4</whitelist>
<orgslist>org1
org2</orgslist>
<whiteListLabels>label1
label2</whiteListLabels>
<blackListLabels>label3
label4</blackListLabels>
<cron>* * * * *</cron>
<buildDescTemplate>build description</buildDescTemplate>
<triggerPhrase>retest this please</triggerPhrase>
<skipBuildPhrase>no tests</skipBuildPhrase>
<onlyTriggerPhrase>true</onlyTriggerPhrase>
<useGitHubHooks>true</useGitHubHooks>
<permitAll>false</permitAll>
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
<whiteListTargetBranches>
<org.jenkinsci.plugins.ghprb.GhprbBranch>
<branch>master</branch>
</org.jenkinsci.plugins.ghprb.GhprbBranch>
<org.jenkinsci.plugins.ghprb.GhprbBranch>
<branch>testing</branch>
</org.jenkinsci.plugins.ghprb.GhprbBranch>
</whiteListTargetBranches>
<gitHubAuthId>123-456-789</gitHubAuthId>
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
</triggers>
</project>