Merge "Fix timeout wrapper version detection"

This commit is contained in:
Zuul 2018-02-08 20:55:26 +00:00 committed by Gerrit Code Review
commit ed07d8fa94
12 changed files with 92 additions and 71 deletions

View File

@ -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)

View File

@ -110,12 +110,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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -114,12 +114,14 @@ print(&quot;Doing something cool with python&quot;)
<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>

View File

@ -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>

View File

@ -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>

View File

@ -33,12 +33,14 @@ echo &quot;Doing somethiung cool&quot;
<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>

View File

@ -30,12 +30,14 @@ VERSION=&quot;1.1&quot;
<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>

View File

@ -30,12 +30,14 @@ VERSION=&quot;1.2&quot;
<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>

View File

@ -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>