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.' prefix = 'hudson.plugins.build__timeout.'
twrapper = XML.SubElement(xml_parent, prefix + 'BuildTimeoutWrapper') twrapper = XML.SubElement(xml_parent, prefix + 'BuildTimeoutWrapper')
plugin_info = registry.get_plugin_info( plugin_info = registry.get_plugin_info("Build Timeout")
"Jenkins build timeout plugin") if "version" not in plugin_info:
version = pkg_resources.parse_version(plugin_info.get("version", "0")) 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', valid_strategies = ['absolute', 'no-activity', 'likely-stuck', 'elastic',
'deadline'] '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') strategy = data.get('type', 'absolute')
if strategy not in valid_strategies: if strategy not in valid_strategies:
InvalidAttributeError('type', strategy, valid_strategies) InvalidAttributeError('type', strategy, valid_strategies)

View File

@ -110,12 +110,14 @@ print("Doing something cool with python")
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper> <org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
<buildSteps> <buildSteps>

View File

@ -2,13 +2,13 @@
<project> <project>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <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> <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
<failBuild>true</failBuild>
<writingDescription>false</writingDescription>
<timeoutPercentage>0</timeoutPercentage>
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
<timeoutType>absolute</timeoutType>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
</buildWrappers> </buildWrappers>
</project> </project>

View File

@ -2,12 +2,12 @@
<project> <project>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.LikelyStuckTimeOutStrategy">
<failBuild>false</failBuild> <timeoutMinutes>3</timeoutMinutes>
<writingDescription>false</writingDescription> </strategy>
<timeoutPercentage>0</timeoutPercentage> <operationList>
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault> <hudson.plugins.build__timeout.operations.AbortOperation/>
<timeoutType>likelyStuck</timeoutType> </operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
</buildWrappers> </buildWrappers>
</project> </project>

View File

@ -2,13 +2,15 @@
<project> <project>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <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> <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
<failBuild>true</failBuild>
<writingDescription>false</writingDescription>
<timeoutPercentage>150</timeoutPercentage>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutType>elastic</timeoutType>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
</buildWrappers> </buildWrappers>
</project> </project>

View File

@ -114,12 +114,14 @@ print(&quot;Doing something cool with python&quot;)
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper> <org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
<buildSteps> <buildSteps>

View File

@ -23,12 +23,14 @@
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper> <org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
<buildSteps> <buildSteps>

View File

@ -23,12 +23,14 @@
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper> <org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
<buildSteps> <buildSteps>

View File

@ -33,12 +33,14 @@ echo &quot;Doing somethiung cool&quot;
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
</buildWrappers> </buildWrappers>
</project> </project>

View File

@ -30,12 +30,14 @@ VERSION=&quot;1.1&quot;
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
</buildWrappers> </buildWrappers>
</project> </project>

View File

@ -30,12 +30,14 @@ VERSION=&quot;1.2&quot;
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>3</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy">
<failBuild>true</failBuild> <timeoutPercentage>150</timeoutPercentage>
<writingDescription>false</writingDescription> <numberOfBuilds>0</numberOfBuilds>
<timeoutPercentage>150</timeoutPercentage> <timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault>
<timeoutMinutesElasticDefault>90</timeoutMinutesElasticDefault> </strategy>
<timeoutType>elastic</timeoutType> <operationList>
<hudson.plugins.build__timeout.operations.FailOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper> <org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
<buildSteps> <buildSteps>

View File

@ -13,12 +13,12 @@
<publishers/> <publishers/>
<buildWrappers> <buildWrappers>
<hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.build__timeout.BuildTimeoutWrapper>
<timeoutMinutes>180</timeoutMinutes> <strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy">
<failBuild>true</failBuild> <timeoutMinutes>180</timeoutMinutes>
<writingDescription>false</writingDescription> </strategy>
<timeoutPercentage>0</timeoutPercentage> <operationList>
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault> <hudson.plugins.build__timeout.operations.FailOperation/>
<timeoutType>absolute</timeoutType> </operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper> </hudson.plugins.build__timeout.BuildTimeoutWrapper>
<hudson.plugins.timestamper.TimestamperBuildWrapper/> <hudson.plugins.timestamper.TimestamperBuildWrapper/>
</buildWrappers> </buildWrappers>