diff options
author | Barak Korren <bkorren@redhat.com> | 2018-07-05 10:02:58 +0300 |
---|---|---|
committer | Barak Korren <bkorren@redhat.com> | 2018-07-05 10:33:33 +0300 |
commit | 11941c87f448ce525eec9a8ca77c00c2b119eee7 (patch) | |
tree | 50a0a139899736a046c10108255b4fdcfeb8086b | |
parent | 637676375a719a60205615ce407bee568b6051ab (diff) | |
download | python-jenkins-job-builder-11941c87f448ce525eec9a8ca77c00c2b119eee7.tar.gz python-jenkins-job-builder-11941c87f448ce525eec9a8ca77c00c2b119eee7.tar.xz python-jenkins-job-builder-11941c87f448ce525eec9a8ca77c00c2b119eee7.zip |
Fix bug in Git 'skip-tag' backwards compatibility
Using the (deprecated) 'skip-tag' option in Git SCM did not work as
expected, despite code in place to maintain compatibility with it.
This needs to work to allow smooth transition for projects from JJB 1.x
to 2.x.
Also added a test case to expose the issue.
Change-Id: I90230f9fe97757bcc70e35b829fc887839a19e57
Signed-off-by: Barak Korren <bkorren@redhat.com>
-rw-r--r-- | jenkins_jobs/modules/scm.py | 2 | ||||
-rw-r--r-- | tests/scm/fixtures/git-extensions03.xml | 45 | ||||
-rw-r--r-- | tests/scm/fixtures/git-extensions03.yaml | 16 |
3 files changed, 62 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/scm.py b/jenkins_jobs/modules/scm.py index 54b597c6..c82d106e 100644 --- a/jenkins_jobs/modules/scm.py +++ b/jenkins_jobs/modules/scm.py @@ -432,7 +432,7 @@ def git(registry, xml_parent, data): # The default value of per-build-tag is False if skip-tag is not set, # so we set the default value of skip-tag to True. per_build_tag_default = False - if str(data.get('skip-tag', True)).lower == 'false': + if str(data.get('skip-tag', True)).lower() == 'false': per_build_tag_default = True if str(data.get('per-build-tag', per_build_tag_default)).lower() == 'true': diff --git a/tests/scm/fixtures/git-extensions03.xml b/tests/scm/fixtures/git-extensions03.xml new file mode 100644 index 00000000..8f9fd2b9 --- /dev/null +++ b/tests/scm/fixtures/git-extensions03.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<project> + <scm class="hudson.plugins.git.GitSCM"> + <configVersion>2</configVersion> + <userRemoteConfigs> + <hudson.plugins.git.UserRemoteConfig> + <name>origin</name> + <refspec>+refs/heads/*:refs/remotes/origin/*</refspec> + <url>https://example.com/project.git</url> + </hudson.plugins.git.UserRemoteConfig> + </userRemoteConfigs> + <branches> + <hudson.plugins.git.BranchSpec> + <name>master</name> + </hudson.plugins.git.BranchSpec> + </branches> + <disableSubmodules>false</disableSubmodules> + <recursiveSubmodules>false</recursiveSubmodules> + <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations> + <remotePoll>false</remotePoll> + <gitTool>Default</gitTool> + <submoduleCfg class="list"/> + <reference/> + <gitConfigName/> + <gitConfigEmail/> + <extensions> + <hudson.plugins.git.extensions.impl.RelativeTargetDirectory> + <relativeTargetDir>go/src/github.com/foo/example</relativeTargetDir> + </hudson.plugins.git.extensions.impl.RelativeTargetDirectory> + <hudson.plugins.git.extensions.impl.UserExclusion> + <excludedUsers>alice@example.com +bob@example.com</excludedUsers> + </hudson.plugins.git.extensions.impl.UserExclusion> + <hudson.plugins.git.extensions.impl.ScmName> + <name>something_special</name> + </hudson.plugins.git.extensions.impl.ScmName> + <hudson.plugins.git.extensions.impl.PerBuildTag/> + <hudson.plugins.git.extensions.impl.PruneStaleBranch/> + <hudson.plugins.git.extensions.impl.AuthorInChangelog/> + </extensions> + <browser class="hudson.plugins.git.browser.GithubWeb"> + <url>http://github.com/foo/example.git</url> + </browser> + </scm> +</project> diff --git a/tests/scm/fixtures/git-extensions03.yaml b/tests/scm/fixtures/git-extensions03.yaml new file mode 100644 index 00000000..98eec9c9 --- /dev/null +++ b/tests/scm/fixtures/git-extensions03.yaml @@ -0,0 +1,16 @@ +scm: + - git: + url: https://example.com/project.git + branches: + - master + browser: githubweb + browser-url: http://github.com/foo/example.git + basedir: 'go/src/github.com/foo/example' + excluded-users: + - alice@example.com + - bob@example.com + skip-tag: false + prune: true + scm-name: something_special + use-author: true + wipe-workspace: false |