diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index e00f18003..acf6c1fc3 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -311,14 +311,19 @@ def timeout(registry, xml_parent, data): prefix = 'hudson.plugins.build__timeout.' twrapper = XML.SubElement(xml_parent, prefix + 'BuildTimeoutWrapper') - plugin_info = registry.get_plugin_info( - "Jenkins build timeout plugin") - version = pkg_resources.parse_version(plugin_info.get("version", "0")) + plugin_info = registry.get_plugin_info("Build Timeout") + if "version" not in plugin_info: + plugin_info = registry.get_plugin_info("Jenkins build timeout plugin") + version = plugin_info.get("version", None) + if version: + version = pkg_resources.parse_version(version) valid_strategies = ['absolute', 'no-activity', 'likely-stuck', 'elastic', 'deadline'] - if version >= pkg_resources.parse_version("1.14"): + # NOTE(toabctl): if we don't know the version assume that we + # use a newer version of the plugin + if not version or version >= pkg_resources.parse_version("1.14"): strategy = data.get('type', 'absolute') if strategy not in valid_strategies: InvalidAttributeError('type', strategy, valid_strategies) diff --git a/tests/jsonparser/fixtures/complete001.xml b/tests/jsonparser/fixtures/complete001.xml index bbaaad0f4..355fac1ac 100644 --- a/tests/jsonparser/fixtures/complete001.xml +++ b/tests/jsonparser/fixtures/complete001.xml @@ -110,12 +110,14 @@ print("Doing something cool with python") - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/wrappers/fixtures/timeout/timeout001.xml b/tests/wrappers/fixtures/timeout/timeout001.xml index 8e6fbd82c..cbbb0d351 100644 --- a/tests/wrappers/fixtures/timeout/timeout001.xml +++ b/tests/wrappers/fixtures/timeout/timeout001.xml @@ -2,13 +2,13 @@ - 90 + + 90 + + + + BUILD_TIMEOUT - true - false - 0 - 3 - absolute diff --git a/tests/wrappers/fixtures/timeout/timeout002.xml b/tests/wrappers/fixtures/timeout/timeout002.xml index b7e1c68f8..60192eeb7 100644 --- a/tests/wrappers/fixtures/timeout/timeout002.xml +++ b/tests/wrappers/fixtures/timeout/timeout002.xml @@ -2,12 +2,12 @@ - 3 - false - false - 0 - 3 - likelyStuck + + 3 + + + + - \ No newline at end of file + diff --git a/tests/wrappers/fixtures/timeout/timeout003.xml b/tests/wrappers/fixtures/timeout/timeout003.xml index 727d9a33f..0b671de27 100644 --- a/tests/wrappers/fixtures/timeout/timeout003.xml +++ b/tests/wrappers/fixtures/timeout/timeout003.xml @@ -2,13 +2,15 @@ - 3 + + 150 + 0 + 90 + + + + BUILD_TIMEOUT - true - false - 150 - 90 - elastic diff --git a/tests/yamlparser/fixtures/complete001.xml b/tests/yamlparser/fixtures/complete001.xml index f6c5192d0..546fd5e68 100644 --- a/tests/yamlparser/fixtures/complete001.xml +++ b/tests/yamlparser/fixtures/complete001.xml @@ -114,12 +114,14 @@ print("Doing something cool with python") - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/yamlparser/fixtures/include-raw001.xml b/tests/yamlparser/fixtures/include-raw001.xml index 494410c5f..7ec205f11 100644 --- a/tests/yamlparser/fixtures/include-raw001.xml +++ b/tests/yamlparser/fixtures/include-raw001.xml @@ -23,12 +23,14 @@ - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/yamlparser/fixtures/include001.xml b/tests/yamlparser/fixtures/include001.xml index 640c3edbb..ec833ab2b 100644 --- a/tests/yamlparser/fixtures/include001.xml +++ b/tests/yamlparser/fixtures/include001.xml @@ -23,12 +23,14 @@ - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/yamlparser/fixtures/lazy-load-jobs-multi001.xml b/tests/yamlparser/fixtures/lazy-load-jobs-multi001.xml index 2df35f290..4d0d39bfe 100644 --- a/tests/yamlparser/fixtures/lazy-load-jobs-multi001.xml +++ b/tests/yamlparser/fixtures/lazy-load-jobs-multi001.xml @@ -33,12 +33,14 @@ echo "Doing somethiung cool" - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/yamlparser/fixtures/lazy-load-jobs001.xml b/tests/yamlparser/fixtures/lazy-load-jobs001.xml index 62a32bfe9..bc6d7aeb7 100644 --- a/tests/yamlparser/fixtures/lazy-load-jobs001.xml +++ b/tests/yamlparser/fixtures/lazy-load-jobs001.xml @@ -30,12 +30,14 @@ VERSION="1.1" - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/yamlparser/fixtures/lazy-load-jobs002.xml b/tests/yamlparser/fixtures/lazy-load-jobs002.xml index 446e1dc10..b44a01546 100644 --- a/tests/yamlparser/fixtures/lazy-load-jobs002.xml +++ b/tests/yamlparser/fixtures/lazy-load-jobs002.xml @@ -30,12 +30,14 @@ VERSION="1.2" - 3 - true - false - 150 - 90 - elastic + + 150 + 0 + 90 + + + + diff --git a/tests/yamlparser/fixtures/yaml_anchor.xml b/tests/yamlparser/fixtures/yaml_anchor.xml index 658689643..9d18713d0 100644 --- a/tests/yamlparser/fixtures/yaml_anchor.xml +++ b/tests/yamlparser/fixtures/yaml_anchor.xml @@ -13,12 +13,12 @@ - 180 - true - false - 0 - 3 - absolute + + 180 + + + +