Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15:Update
python-jenkins-job-builder
0001-Fix-timeout-wrapper-version-detection.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-timeout-wrapper-version-detection.patch of Package python-jenkins-job-builder
From a9ea7223f6c3c1c4dbf95126661eb1bd64236b88 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold <tbechtold@suse.com> Date: Tue, 18 Oct 2016 07:56:57 +0200 Subject: [PATCH] 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. Alo adjust fixtures to use the newer plugin version xml output. Change-Id: I86295933d0c3247f55d0114473fc9c8f8feb7441 --- jenkins_jobs/modules/wrappers.py | 8 ++++++-- tests/jsonparser/fixtures/complete001.xml | 14 ++++++++------ tests/wrappers/fixtures/timeout/timeout001.xml | 12 ++++++------ tests/wrappers/fixtures/timeout/timeout002.xml | 14 +++++++------- tests/wrappers/fixtures/timeout/timeout003.xml | 14 ++++++++------ tests/yamlparser/fixtures/complete001.xml | 14 ++++++++------ tests/yamlparser/fixtures/include-raw001.xml | 14 ++++++++------ tests/yamlparser/fixtures/include001.xml | 14 ++++++++------ tests/yamlparser/fixtures/yaml_anchor.xml | 12 ++++++------ 9 files changed, 65 insertions(+), 51 deletions(-) Index: jenkins-job-builder-1.6.1/jenkins_jobs/modules/wrappers.py =================================================================== --- jenkins-job-builder-1.6.1.orig/jenkins_jobs/modules/wrappers.py +++ jenkins-job-builder-1.6.1/jenkins_jobs/modules/wrappers.py @@ -312,12 +312,16 @@ def timeout(parser, xml_parent, data): plugin_info = parser.registry.get_plugin_info( "Jenkins build timeout plugin") - version = pkg_resources.parse_version(plugin_info.get("version", "0")) + 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) Index: jenkins-job-builder-1.6.1/tests/jsonparser/fixtures/complete001.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/jsonparser/fixtures/complete001.xml +++ jenkins-job-builder-1.6.1/tests/jsonparser/fixtures/complete001.xml @@ -115,12 +115,14 @@ print("Doing something cool with py <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> Index: jenkins-job-builder-1.6.1/tests/wrappers/fixtures/timeout/timeout001.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/wrappers/fixtures/timeout/timeout001.xml +++ jenkins-job-builder-1.6.1/tests/wrappers/fixtures/timeout/timeout001.xml @@ -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> Index: jenkins-job-builder-1.6.1/tests/wrappers/fixtures/timeout/timeout002.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/wrappers/fixtures/timeout/timeout002.xml +++ jenkins-job-builder-1.6.1/tests/wrappers/fixtures/timeout/timeout002.xml @@ -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> \ No newline at end of file +</project> Index: jenkins-job-builder-1.6.1/tests/wrappers/fixtures/timeout/timeout003.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/wrappers/fixtures/timeout/timeout003.xml +++ jenkins-job-builder-1.6.1/tests/wrappers/fixtures/timeout/timeout003.xml @@ -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> Index: jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/complete001.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/yamlparser/fixtures/complete001.xml +++ jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/complete001.xml @@ -118,12 +118,14 @@ print("Doing something cool with py <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> Index: jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/include-raw001.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/yamlparser/fixtures/include-raw001.xml +++ jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/include-raw001.xml @@ -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> Index: jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/include001.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/yamlparser/fixtures/include001.xml +++ jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/include001.xml @@ -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> Index: jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/yaml_anchor.xml =================================================================== --- jenkins-job-builder-1.6.1.orig/tests/yamlparser/fixtures/yaml_anchor.xml +++ jenkins-job-builder-1.6.1/tests/yamlparser/fixtures/yaml_anchor.xml @@ -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>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor