summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanh Ha <thanh.ha@linuxfoundation.org>2017-06-28 18:59:29 -0400
committerThanh Ha <thanh.ha@linuxfoundation.org>2017-07-26 13:07:32 -0400
commit70e6adb4eb88a294d3cd6efc5a102dfb62db5137 (patch)
tree46a933bbf6ba69bf2be0efaa54a1a07222092be2
parent8cfe815e8845124b746cde8e3b9cf3deb314513a (diff)
downloadpython-jenkins-job-builder-70e6adb4eb88a294d3cd6efc5a102dfb62db5137.tar.gz
python-jenkins-job-builder-70e6adb4eb88a294d3cd6efc5a102dfb62db5137.tar.xz
python-jenkins-job-builder-70e6adb4eb88a294d3cd6efc5a102dfb62db5137.zip
Default gitlab to newest plugin config format
Change-Id: I51ca15b9bfef42b79e03c4a2ba0bb9f23d880188 Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
-rw-r--r--jenkins_jobs/modules/triggers.py7
-rw-r--r--tests/triggers/fixtures/gitlab001.plugins_info.yaml3
-rw-r--r--tests/triggers/fixtures/gitlab002.plugins_info.yaml3
-rw-r--r--tests/triggers/fixtures/gitlab003.plugins_info.yaml3
4 files changed, 15 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py
index 99db03b1..bf45ea5a 100644
--- a/jenkins_jobs/modules/triggers.py
+++ b/jenkins_jobs/modules/triggers.py
@@ -32,6 +32,7 @@ Example::
import logging
import pkg_resources
import re
+import sys
import xml.etree.ElementTree as XML
import six
@@ -1238,8 +1239,12 @@ def gitlab(registry, xml_parent, data):
gitlab = XML.SubElement(
xml_parent, 'com.dabsquared.gitlabjenkins.GitLabPushTrigger'
)
+
plugin_info = registry.get_plugin_info('GitLab Plugin')
- plugin_ver = pkg_resources.parse_version(plugin_info.get('version', "0"))
+ # Note: Assume latest version of plugin is preferred config format
+ plugin_ver = pkg_resources.parse_version(
+ plugin_info.get('version', str(sys.maxsize)))
+
valid_merge_request = ['never', 'source', 'both']
if plugin_ver >= pkg_resources.parse_version("1.1.26"):
diff --git a/tests/triggers/fixtures/gitlab001.plugins_info.yaml b/tests/triggers/fixtures/gitlab001.plugins_info.yaml
new file mode 100644
index 00000000..235eb291
--- /dev/null
+++ b/tests/triggers/fixtures/gitlab001.plugins_info.yaml
@@ -0,0 +1,3 @@
+- longName: 'GitLab Plugin'
+ shortName: 'gitlab-plugin'
+ version: "0"
diff --git a/tests/triggers/fixtures/gitlab002.plugins_info.yaml b/tests/triggers/fixtures/gitlab002.plugins_info.yaml
new file mode 100644
index 00000000..235eb291
--- /dev/null
+++ b/tests/triggers/fixtures/gitlab002.plugins_info.yaml
@@ -0,0 +1,3 @@
+- longName: 'GitLab Plugin'
+ shortName: 'gitlab-plugin'
+ version: "0"
diff --git a/tests/triggers/fixtures/gitlab003.plugins_info.yaml b/tests/triggers/fixtures/gitlab003.plugins_info.yaml
new file mode 100644
index 00000000..235eb291
--- /dev/null
+++ b/tests/triggers/fixtures/gitlab003.plugins_info.yaml
@@ -0,0 +1,3 @@
+- longName: 'GitLab Plugin'
+ shortName: 'gitlab-plugin'
+ version: "0"