Fix timeout wrapper version detection
If, for whatever reason, the version of the build-timeout plugin can not be detected, assume that we use a newer version (>= 1.14). Version 1.14 is already ~ 2 1/2 years old so this is a sane assumption. Also adjust fixtures to use the newer plugin version xml output. Change-Id: I86295933d0c3247f55d0114473fc9c8f8feb7441 Signed-off-by: Bertrand Roussel <broussel@sierrawireless.com> Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This commit is contained in:
parent
0b5ed0345a
commit
ecf3933dc2
@ -312,14 +312,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)
|
||||
|
@ -109,12 +109,14 @@ print("Doing something cool with python")
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
|
@ -2,13 +2,13 @@
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>90</timeoutMinutes>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy">
|
||||
<timeoutMinutes>90</timeoutMinutes>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
<timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>0</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
|
||||
<timeoutType>absolute</timeoutType>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
||||
|
@ -2,12 +2,12 @@
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>false</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>0</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
|
||||
<timeoutType>likelyStuck</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.LikelyStuckTimeOutStrategy">
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.AbortOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
||||
</project>
|
||||
|
@ -2,13 +2,15 @@
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
<timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
||||
|
@ -112,12 +112,14 @@ print("Doing something cool with python")
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
|
@ -23,12 +23,14 @@
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
|
@ -23,12 +23,14 @@
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
|
@ -33,12 +33,14 @@ echo "Doing somethiung cool"
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
||||
|
@ -30,12 +30,14 @@ VERSION="1.1"
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
||||
|
@ -30,12 +30,14 @@ VERSION="1.2"
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>3</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
<timeoutType>elastic</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
|
||||
<timeoutPercentage>150</timeoutPercentage>
|
||||
<numberOfBuilds>0</numberOfBuilds>
|
||||
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
|
@ -13,12 +13,12 @@
|
||||
<publishers/>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<timeoutMinutes>180</timeoutMinutes>
|
||||
<failBuild>true</failBuild>
|
||||
<writingDescription>false</writingDescription>
|
||||
<timeoutPercentage>0</timeoutPercentage>
|
||||
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
|
||||
<timeoutType>absolute</timeoutType>
|
||||
<strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy">
|
||||
<timeoutMinutes>180</timeoutMinutes>
|
||||
</strategy>
|
||||
<operationList>
|
||||
<hudson.plugins.build__timeout.operations.FailOperation/>
|
||||
</operationList>
|
||||
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
||||
<hudson.plugins.timestamper.TimestamperBuildWrapper/>
|
||||
</buildWrappers>
|
||||
|
Loading…
Reference in New Issue
Block a user