From eed624909848dff1f4f64435a1a7fd913f715f70 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 28 Jun 2017 00:16:31 -0400 Subject: [PATCH] Default groovy-postbuild to newest plugin format Change-Id: I82747a5579c081b524363aa97281ae6d65d8c21d Signed-off-by: Thanh Ha --- jenkins_jobs/modules/publishers.py | 5 ++++- .../fixtures/groovy-postbuild000.plugins_info.yaml | 3 +++ .../fixtures/groovy-postbuild004.plugins_info.yaml | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/publishers/fixtures/groovy-postbuild000.plugins_info.yaml create mode 100644 tests/publishers/fixtures/groovy-postbuild004.plugins_info.yaml diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index b730e7a07..e5ad8330d 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -27,6 +27,7 @@ the build is complete. import logging import pkg_resources +import sys import xml.etree.ElementTree as XML import six @@ -2444,7 +2445,9 @@ def groovy_postbuild(registry, xml_parent, data): } # There are incompatible changes, we need to know version info = registry.get_plugin_info('groovy-postbuild') - version = pkg_resources.parse_version(info.get('version', "0")) + # Note: Assume latest version of plugin is preferred config format + version = pkg_resources.parse_version( + info.get('version', str(sys.maxsize))) # Version specific predicates matrix_parent_support = version >= pkg_resources.parse_version("1.9") security_plugin_support = version >= pkg_resources.parse_version("2.0") diff --git a/tests/publishers/fixtures/groovy-postbuild000.plugins_info.yaml b/tests/publishers/fixtures/groovy-postbuild000.plugins_info.yaml new file mode 100644 index 000000000..858adc028 --- /dev/null +++ b/tests/publishers/fixtures/groovy-postbuild000.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'Groovy Postbuild' + shortName: 'groovy-postbuild' + version: "1.0" diff --git a/tests/publishers/fixtures/groovy-postbuild004.plugins_info.yaml b/tests/publishers/fixtures/groovy-postbuild004.plugins_info.yaml new file mode 100644 index 000000000..858adc028 --- /dev/null +++ b/tests/publishers/fixtures/groovy-postbuild004.plugins_info.yaml @@ -0,0 +1,3 @@ +- longName: 'Groovy Postbuild' + shortName: 'groovy-postbuild' + version: "1.0"