diff options
author | Daniel Belenky <daniel.belenky@gmail.com> | 2018-11-11 19:29:29 +0200 |
---|---|---|
committer | Daniel Belenky <daniel.belenky@gmail.com> | 2018-11-14 10:47:36 +0200 |
commit | 3806c9c3d74540869d7349b32aa6ad060584b79d (patch) | |
tree | 2063badbea41812e2a9518ad8f26a3eb94febab3 /tests/yamlparser/fixtures | |
parent | 2854caec9e82ff22f3a8c086f881e10b5a0d418e (diff) | |
download | python-jenkins-job-builder-3806c9c3d74540869d7349b32aa6ad060584b79d.tar.gz python-jenkins-job-builder-3806c9c3d74540869d7349b32aa6ad060584b79d.tar.xz python-jenkins-job-builder-3806c9c3d74540869d7349b32aa6ad060584b79d.zip |
Handle cancel-builds-on-update values from vars
The code assumes that the value of cancel-builds-on-update is a boolean.
This fails when specifying the value of the param in a variable because when
deep_formatter formats the data, booleans turn into strings.
Also added tests for such case.
Change-Id: Ib1ec3d5545091be550bfe023e49c7982372d5b55
Signed-off-by: Daniel Belenky <daniel.belenky@gmail.com>
Diffstat (limited to 'tests/yamlparser/fixtures')
4 files changed, 97 insertions, 0 deletions
diff --git a/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable001.xml b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable001.xml new file mode 100644 index 00000000..0832d960 --- /dev/null +++ b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable001.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <actions/> + <description><!-- Managed by Jenkins Job Builder --></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> diff --git a/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable001.yaml b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable001.yaml new file mode 100644 index 00000000..a3245c2c --- /dev/null +++ b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable001.yaml @@ -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' diff --git a/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable002.xml b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable002.xml new file mode 100644 index 00000000..1d913309 --- /dev/null +++ b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable002.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <actions/> + <description><!-- Managed by Jenkins Job Builder --></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> diff --git a/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable002.yaml b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable002.yaml new file mode 100644 index 00000000..39c35c42 --- /dev/null +++ b/tests/yamlparser/fixtures/github_cancel_builds_on_update_variable002.yaml @@ -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' |