Merge "Handle cancel-builds-on-update values from vars"

This commit is contained in:
Zuul 2018-11-19 01:55:15 +00:00 committed by Gerrit Code Review
commit d29998eaa9
5 changed files with 101 additions and 1 deletions

View File

@ -1117,7 +1117,10 @@ def github_pull_request(registry, xml_parent, data):
error_comment
)
cancel_builds_on_update = data.get('cancel-builds-on-update', False)
# When the value of cancel-builds-on-update comes from deep_formatter,
# the value is of type 'str', otherwise the value is of type 'bool'
cancel_builds_on_update = str(
data.get('cancel-builds-on-update', False)).lower() == 'true'
# We want to have only one 'extensions' subelement, even if status
# handling, comment handling and other extensions are enabled.

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<triggers class="vector">
<org.jenkinsci.plugins.ghprb.GhprbTrigger>
<adminlist/>
<whitelist/>
<orgslist/>
<whiteListLabels/>
<blackListLabels/>
<excludedRegions/>
<includedRegions/>
<spec/>
<allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
<cron/>
<triggerPhrase/>
<skipBuildPhrase/>
<onlyTriggerPhrase>false</onlyTriggerPhrase>
<useGitHubHooks>false</useGitHubHooks>
<permitAll>false</permitAll>
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
<extensions>
<org.jenkinsci.plugins.ghprb.extensions.build.GhprbCancelBuildsOnUpdate/>
</extensions>
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
</triggers>
<builders/>
<publishers/>
<buildWrappers/>
</project>

View File

@ -0,0 +1,12 @@
---
- job-template:
name: 'github-pull-request-variable-test-true'
triggers:
- github-pull-request:
cancel-builds-on-update: '{test-var}'
- project:
name: test-true
test-var: true
jobs:
- 'github-pull-request-variable-test-true'

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<triggers class="vector">
<org.jenkinsci.plugins.ghprb.GhprbTrigger>
<adminlist/>
<whitelist/>
<orgslist/>
<whiteListLabels/>
<blackListLabels/>
<excludedRegions/>
<includedRegions/>
<spec/>
<allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
<cron/>
<triggerPhrase/>
<skipBuildPhrase/>
<onlyTriggerPhrase>false</onlyTriggerPhrase>
<useGitHubHooks>false</useGitHubHooks>
<permitAll>false</permitAll>
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
</triggers>
<builders/>
<publishers/>
<buildWrappers/>
</project>

View File

@ -0,0 +1,12 @@
---
- job-template:
name: 'github-pull-request-variable-test-false'
triggers:
- github-pull-request:
cancel-builds-on-update: '{test-var}'
- project:
name: test-false
test-var: false
jobs:
- 'github-pull-request-variable-test-false'