Code Monkey home page Code Monkey logo

build-timeout-plugin's Introduction

Build Timeout Plugin

This plugin allows you to automatically terminate a build if it’s taking too long.

This plugin isn’t applicable to pipelines.

Instructions for the user

Global configuration

Go to Manage Jenkins and then Configure System. Under the item Global Build Time Out you can activate a global timeout which will be applied to any job. Choose your timeout strategy, the duration and add actions which should be executed at timeout.

In addition, the option can be activated that individual jobs can overwrite the global timeout if they provide a corresponding build step.

global config

Note that sometimes if a project is not of the hudson.model.Project type, then the individual jobs would not be allowed to overwrite the global timeout.

Build environment

Alternatively, the timeout can be specified in the build environment of a job. To do this, click Configure in the job view and in the build environment section, select the item Terminate a build if it’s stuck.

build environment

Because Java only allows threads to be interrupted at a set of fixed locations, depending on how a build hangs, the abort operation might not take effect. For example,

  • if Jenkins is waiting for child processes to complete, it can abort right away.

  • if Jenkins is stuck in an infinite loop, it can never be aborted.

  • if Jenkins is doing a network or file I/O within the Java VM (such as lengthy file copy or SVN update), it cannot be aborted.

So if you think the build timeout isn’t taking effect, our default assumption is that the build is hanging at the place that cannot be interrupted. If you suspect otherwise, please obtain the thread dump and report it.

Build step

Add a new step Run with timeout at the section Build, add the timeout strategy and duration, add some actions and the build step you want to execute within the timout step.

build step

For developers

If you are interested in contributing, please pay attention to the below steps:

To test

mvn verify

To build

mvn hpi:run

For newcomers, please see guide at https://www.jenkins.io/participate/ for more information about how to participate and contribute.

Time-out actions with notes

Time-out action Note

Abort and restart the build

Installing Naginator Plugin enables this action

build-timeout-plugin's People

Contributors

alanharder avatar amuniz avatar armfergom avatar barukreddy avatar basil avatar christ66 avatar daniel-beck avatar darxriggs avatar fbelzunc avatar fmiguelez avatar ikedam avatar ikikko avatar jglick avatar jimilian avatar jsoref avatar jtnord avatar kohsuke avatar krisstern avatar ndeloof avatar recampbell avatar redsolo avatar sghill avatar sghill-rewrite avatar ssogabe avatar stephenc avatar timja avatar tyuki39 avatar wilfred avatar yunir avatar zaro0508 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

build-timeout-plugin's Issues

Acccess build-timeout-plugin details using Jenkins API

What feature do you want to see added?

How do I access build-timeout-plugin details using Jenkins API? For eg, https:///jenkins///api/json?depth=2 doesn't help.

Upstream changes

No response

Are you interested in contributing this feature?

No response

Jenkins startup error log for "hudson.plugins.build_timeout.operations.AbortAnd RestartOperation"

During Jenkins startup/restart I am always getting an INFO log:

2018-04-03 10:25:09 INFO [hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error]   Failed to instantiate optional component hudson.plugins.build_timeout.operations.AbortAnd
RestartOperation$DescriptorImpl; skipping

IIRC this happens ever since I installed Jenkins (and I guess this plugin) and now Jenkins version is 2.114 (latest release) and Build Timeout plugin version is 1.19 (latest).

Frankly I think we are not even using this plugin at the moment, but just found this error log irritating and thus at long last dared to file this little issue...

Here is a little bit more Jenkins start-up log context:

2018-04-03 10:25:33 INFO [jenkins.InitReactorRunner$1 onAttained]   Started initialization
2018-04-03 10:25:34 INFO [jenkins.InitReactorRunner$1 onAttained]   Listed all plugins
2018-04-03 10:25:35 INFO [hudson.plugins.ansicolor.PluginImpl start]   AnsiColor: eliminating boring output (https://github.com/jenkinsci/ansicolor-plugin)
2018-04-03 10:25:47 INFO [jenkins.InitReactorRunner$1 onAttained]   Prepared all plugins
2018-04-03 10:25:49 INFO [hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error]   Failed to instantiate optional component hudson.plugins.build_timeout.operations.AbortAnd
RestartOperation$DescriptorImpl; skipping
2018-04-03 10:25:50 INFO [jenkins.InitReactorRunner$1 onAttained]   Started all plugins

Support adding action to show the timeout cause in the build

What feature do you want to see added?

A new feature to add action to show the timeout cause in the build would be nice if feasible.

An attempt has been made previous in #83, but pull request was closed due to it becoming stale.

Upstream changes

No response

Null Pointer Exception

Using version 1.12 of the plugin on Jenkins version 1.530

When I choose "Abort the build if stuck," there are no strategies available to choose from:

image

When I then try to run a build, I get a null pointer exception:

12:34:27 FATAL: null
12:34:27 java.lang.NullPointerException
12:34:27    at hudson.plugins.build_timeout.BuildTimeoutWrapper$1EnvironmentImpl.<init>(BuildTimeoutWrapper.java:106)
12:34:27    at hudson.plugins.build_timeout.BuildTimeoutWrapper.setUp(BuildTimeoutWrapper.java:120)
12:34:27    at hudson.model.Build$BuildExecution.doRun(Build.java:154)
12:34:27    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
12:34:27    at hudson.model.Run.execute(Run.java:1603)
12:34:27    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
12:34:27    at hudson.model.ResourceController.execute(ResourceController.java:88)
12:34:27    at hudson.model.Executor.run(Executor.java:246)

This affects only new jobs created after upgrading; jobs configured with the previous version of the plugin continue to work as expected.

Downgrading to the previous version (1.11) and reconfiguring the job resolves the issue.

No e-mail is sent if build is aborted

Plugin version: 1.14.1

Plugin configuration in the job:

  • Abort the build if it's stuck
    • Time-out strategy: No Activity (180 seconds)
    • Time-out actions: Fail the build
  • Post-build step: e-mail notification for each instable build

Expected result: e-mail is sent if build is failed via time-out plugin.

Actual result: no e-mail is sent.

Ability to run a script before interrupting the executor

In my particular case I want to pull some stats out of a running Tomcat via servlet and WGET before killing the tomcat. I have JBehave/WebDriver jobs leveraging Sauce Labs in fairly large scale, and one or more could be stuck. There are many reasons for that, but part of my build after all is successful, would retrieve the stats, and store them in the build artifacts in a JSON file. However, the build-timeout-plugin is doing a kill -9 style of shutdown on all the processes spawned by Jenkins for the job, and I'm not getting my chance to do the stats step before a more controlled shutdown of the stack.

Support timezone overriding

My Jenkins instance is running in America/New_York timezone and it contains one job that needs to be run in Asia/Shanghai.

The timeout plugin only allows me to enter time in Deadline strategy and it assumes the time is in Jenkins system timezone. In order to abort its builds at a certain time, I need to change the time twice every year because of the daylight saving switches in New York (since Shanghai does not observe daylight saving at all). Can we make timezone configurable in Deadline strategy so that I don't need to remember to manually change this?

Apologies in advance if this is not a proper place for feature requests. I see the Issues tab is open here so didn't think twice. I don't have an Jenkins Jira account.

Stuck jobs are not aborted for any of the timeout strategies

Jenkins and plugins versions report

Environment
Jenkins: 2.387.2
OS: Linux - 5.15.49-linuxkit
Java: 11.0.18 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
ace-editor:1.1
active-directory:2.30
amazon-ecr:1.114.vfd22430621f5
ansible:174.vfd5323d2b_9d8
ansicolor:1.0.2
ant:481.v7b_09e538fcca
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
artifact-promotion:0.5.2
authentication-tokens:1.53.v1c90fd9191a_b_
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk:1.12.406-378.v938a_d577f750
aws-java-sdk-cloudformation:1.12.406-378.v938a_d577f750
aws-java-sdk-codebuild:1.12.406-378.v938a_d577f750
aws-java-sdk-ec2:1.12.406-378.v938a_d577f750
aws-java-sdk-ecr:1.12.406-378.v938a_d577f750
aws-java-sdk-ecs:1.12.406-378.v938a_d577f750
aws-java-sdk-efs:1.12.406-378.v938a_d577f750
aws-java-sdk-elasticbeanstalk:1.12.406-378.v938a_d577f750
aws-java-sdk-iam:1.12.406-378.v938a_d577f750
aws-java-sdk-kinesis:1.12.406-378.v938a_d577f750
aws-java-sdk-logs:1.12.406-378.v938a_d577f750
aws-java-sdk-minimal:1.12.406-378.v938a_d577f750
aws-java-sdk-sns:1.12.406-378.v938a_d577f750
aws-java-sdk-sqs:1.12.406-378.v938a_d577f750
aws-java-sdk-ssm:1.12.406-378.v938a_d577f750
backup:1.6.1
badge:1.9.1
blueocean:1.27.3
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.3
blueocean-commons:1.27.3
blueocean-config:1.27.3
blueocean-core-js:1.27.3
blueocean-dashboard:1.27.3
blueocean-display-url:2.4.1
blueocean-events:1.27.3
blueocean-git-pipeline:1.27.3
blueocean-github-pipeline:1.27.3
blueocean-i18n:1.27.3
blueocean-jwt:1.27.3
blueocean-personalization:1.27.3
blueocean-pipeline-api-impl:1.27.3
blueocean-pipeline-editor:1.27.3
blueocean-pipeline-scm-api:1.27.3
blueocean-rest:1.27.3
blueocean-rest-impl:1.27.3
blueocean-web:1.27.3
bootstrap4-api:4.6.0-5
bootstrap5-api:5.2.2-2
bouncycastle-api:2.27
branch-api:2.1071.v1a_188a_562481
build-pipeline-plugin:1.5.8
build-timeout:1.30
build-user-vars-plugin:1.9
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:2.0.0
cloudbees-bitbucket-branch-source:800.va_b_b_9a_a_5035c1
cloudbees-folder:6.815.v0dd5a_cb_40e0e
command-launcher:90.v669d7ccb_7c31
commons-httpclient3-api:3.1-3
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
conditional-buildstep:1.4.2
configuration-as-code:1625.v27444588cc3d
configuration-as-code-groovy:1.1
configuration-as-code-secret-ssm:1.0.1
copyartifact:686.v6fd37018d7c2
credentials:1224.vc23ca_a_9a_2cb_0
credentials-binding:604.vb_64480b_c56ca_
crowd2:3.2.1
data-tables-api:1.13.3-3
delivery-pipeline-plugin:1.4.2
deploy:1.16
display-url-api:2.3.7
docker-commons:419.v8e3cd84ef49c
docker-workflow:563.vd5d2e5c4007f
durable-task:504.vb10d1ae5ba2f
echarts-api:5.4.0-3
email-ext:2.96
envinject:2.901.v0038b_6471582
envinject-api:1.199.v3ce31253ed13
extensible-choice-parameter:1.8.0
external-monitor-job:203.v683c09d993b_9
favorite:2.4.1
font-awesome-api:6.3.0-2
git:5.0.0
git-client:4.2.0
git-parameter:0.9.18
git-server:99.va_0826a_b_cdfa_d
github:1.37.0
github-api:1.303-417.ve35d9dd78549
github-branch-source:1703.vd5a_2b_29c6cdc
gradle:2.4
groovy-postbuild:2.5
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
htmlpublisher:1.31
http_request:1.16
icon-shim:3.0.0
instance-identity:142.v04572ca_5b_265
ionicons-api:45.vf54fca_5d2154
jackson2-api:2.14.2-319.v37853346a_229
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.8-1
jdk-tool:63.v62d2fd4b_4793
jenkins-design-language:1.27.3
jersey2-api:2.39.1-1
jira:3.9
jjwt-api:0.11.5-77.v646c772fddb_0
jnr-posix-api:3.1.16-2
job-dsl:1.83
jobConfigHistory:1207.vd28a_54732f92
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.6.4-1
jsch:0.1.55.61.va_e9ee26616e7
junit:1189.v1b_e593637fa_e
ldap:671.v2a_9192a_7419d
lockable-resources:1141.v7c5f8f31d2ee
mailer:448.v5b_97805e3767
matrix-auth:3.1.6
matrix-project:785.v06b_7f47b_c631
maven-artifact-choicelistprovider:1.11.0
maven-plugin:3.21
mina-sshd-api-common:2.9.2-62.v199162f0a_2f8
mina-sshd-api-core:2.9.2-62.v199162f0a_2f8
momentjs:1.1.1
monitoring:1.92.0
nexus-artifact-uploader:2.14
nexus-jenkins-plugin:3.16.487.v5d4d3b_6942ee
nexus-task-runner:0.9.2
nodelabelparameter:1.11.0
oauth-credentials:0.5
okhttp-api:4.10.0-132.v7a_7b_91cef39c
pam-auth:1.10
parameterized-trigger:2.45
periodicbackup:2.0
pipeline-build-step:488.v8993df156e8d
pipeline-github-lib:42.v0739460cda_c4
pipeline-global-lib-nexus:0.3.2
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2125.vddb_a_44a_d605e
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:2.2125.vddb_a_44a_d605e
pipeline-model-extensions:2.2125.vddb_a_44a_d605e
pipeline-rest-api:2.32
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2125.vddb_a_44a_d605e
pipeline-stage-view:2.32
pipeline-utility-steps:2.15.1
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.2.0
popper-api:1.16.1-3
popper2-api:2.11.6-2
publish-over:0.22
publish-over-ssh:1.24
pubsub-light:1.17
rebuild:1.34
resource-disposer:0.22
role-strategy:587.588.v850a_20a_30162
run-condition:1.5
scm-api:631.v9143df5b_e4a_a
script-security:1229.v4880b_b_e905a_6
secondary-timestamper-plugin:1.1
simple-build-for-pipeline:0.2
slack:631.v40deea_40323b
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sse-gateway:1.26
ssh:2.6.1
ssh-agent:327.v230ecd01f86f
ssh-credentials:305.v8f4381501156
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.275.v9e17c10f2571
structs:324.va_f5d6774f3a_d
terraform:1.0.10
timestamper:1.24
token-macro:321.vd7cc1f2a_52c8
trilead-api:2.84.v72119de229b_7
uno-choice:2.6.4
variant:59.vf075fe829ccb
view-job-filters:364.v48a_33389553d
windows-slaves:1.8.1
workflow-aggregator:596.v8c21c963d92d
workflow-api:1208.v0cc7c6e0da_9e
workflow-basic-steps:1010.vf7a_b_98e847c1
workflow-cps:3653.v07ea_433c90b_4
workflow-cps-global-lib:609.vd95673f149b_b
workflow-durable-task-step:1241.v1a_63e465f943
workflow-job:1289.vd1c337fd5354
workflow-multibranch:733.v109046189126
workflow-scm-step:408.v7d5b_135a_b_d49
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.45
xml-job-to-job-dsl:0.1.13

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins docker container

Reproduction steps

  • Absolute Strategy of 1 minute
  1. Create a PL job or a Freestyle Job
  2. Create a shell step with a sleep timer 1 second
  3. Run the job 5 times to create job history of job time of few seconds
  4. Configure the timeout plugin with absolute strategy of 1 minute
  5. Run the Job with a sleep timer of 2 minutes
  • Elastic Strategy
  1. Create a PL job or a Freestyle Job
  2. Create a shell step with a sleep timer 1 second
  3. Run the job 5 times to create job history of job time of few seconds
  4. Configure the timeout plugin with elastic strategy Timeout as a percentage of recent non-failing builds 150%, number of builds 5, Timeout minutes 1
  5. Run the Job with a sleep timer of 2 minutes
  • Likely stuck Strategy
  1. Create a PL job or a Freestyle Job
  2. Create a shell step with a sleep timer 1 second
  3. Run the job 5 times to create job history of job time of few seconds
  4. Configure the timeout plugin with elastic strategy Timeout as a percentage of recent non-failing builds 150%, number of builds 5, Timeout minutes 1
  5. Run the Job with a sleep timer of 2 minutes

Expected Results

The Job should be aborted in each of the selected strategy

Actual Results

The Job does not get aborted

Anything else?

No response

Upgrading Jenkins Java version from 8 to 11 for plugin

What feature do you want to see added?

Guidelines for the proposed upgrade can be found at the official documentation here. Basically the goal is to move away from Java 8 to adopt Java 11. This upgrade of JVM is in response to some previous discussions on Java 8 end-of-life within the Jenkins community, and with either the June 2022 or Sep 2022 LTS release dropping Java 8 support entirely. See documentation of this discussion here.

Upstream changes

N/A

Global Build timeout does not work for Multibranch Workflows

Jenkins and plugins versions report

Environment
Result 
  Jenkins: 2.375.4
  OS: Linux - 5.4.228-132.418.amzn2.x86_64
  Java: 17.0.6 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
  ---
  build-timeout:1.28

What Operating System are you using (both controller, and any agents involved in the problem)?

5.4.228-132.418.amzn2.x86_64

Reproduction steps

  1. We have set the global time out to Absolute 3 minutes (the minimum available)
  2. We ran a multibranch workflow

Expected Results

Multibranch workflow should be aborted after 3 mins

Actual Results

The job is never aborted

Anything else?

I can confirm the timeout works on free style jobs, but not in multibranch

Time-out actions have no default operation

When we use this plugin, we need to set the "Time-out actions" manually, otherwise the plugin will never trigger any operation.
But according the description "Abort the build. This is a default operation performed if no operations are specified. ", it should be no need to set the item manually, but always has a default value "Abort the build".
So, the problem is that if we dont set the "Time-out actions" into "Abort the build" manually, the job will never be aborted on time. I dont know, if I create an issue here, is there someone will answer it? Or there are some other websites to raise an issue?

Unexpected Log issue for multi-configuration jobs (Matrix jobs)

Jenkins and plugins versions report

Environment
Jenkins: 2.346.3
OS: Linux - 4.15.0-191-generic
---
Exclusion:0.15
ace-editor:1.1
all-changes:1.5
analysis-model-api:10.16.1
android-emulator:3.1.3
ant:475.vf34069fef73c
antisamy-markup-formatter:2.7
anything-goes-formatter:1.0
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
audit-trail:3.11
authentication-tokens:1.4
authorize-project:1.4.0
badge:1.9.1
bootstrap4-api:4.6.0-5
bootstrap5-api:5.2.0-3
bouncycastle-api:2.26
branch-api:2.1046.v0ca_37783ecc5
build-timeout:1.23
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
categorized-view:1.12
checks-api:1.7.5
cloudbees-folder:6.740.ve4f4ffa_dea_54
cobertura:1.17
code-coverage-api:3.1.0
command-launcher:84.v4a_97f2027398
conditional-buildstep:1.4.2
copyartifact:1.47
cppcheck:1.26
credentials:1139.veb_9579fca_33b_
credentials-binding:523.vd859a_4b_122e6
custom-tools-plugin:0.8
cvs:2.19.1
dashboard-view:2.447.vda_124dd35f11
data-tables-api:1.12.1-3
display-url-api:2.3.6
docker-commons:1.21
docker-workflow:521.v1a_a_dd2073b_2e
dtkit-api:3.0.1
durable-task:500.v8927d9fd99d8
echarts-api:5.3.3-1
email-ext:2.91
emma:1.31
envinject:2.875.v9b_9e962da_a_ec
envinject-api:1.199.v3ce31253ed13
extended-choice-parameter:346.vd87693c5a_86c
extensible-choice-parameter:1.8.0
external-monitor-job:192.ve979ca_8b_3ccd
ez-templates:1.3.5
file-operations:1.11
flexible-publish:0.16.1
font-awesome-api:6.1.2-1
forensics-api:1.15.1
git:4.11.5
git-client:3.11.2
git-server:1.11
github:1.34.5
github-api:1.303-400.v35c2d8258028
github-branch-source:1687.v7618247e672d
gradle:1.39.4
greenballs:1.15.1
groovy:442.v817e6d937d6c
groovy-postbuild:2.5
handlebars:3.0.8
htmlpublisher:1.30
http_request:1.16
ionicons-api:22.v868b_0c347756
jackson2-api:2.13.3-285.vc03c0256d517
jakarta-activation-api:2.0.1-1
jakarta-mail-api:2.0.1-1
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-4
javax-mail-api:1.6.2-7
jaxb:2.3.6-1
jdk-tool:55.v1b_32b_6ca_f9ca
jjwt-api:0.11.5-77.v646c772fddb_0
jnr-posix-api:3.1.15-1
jobConfigHistory:1171.v04b_66d78555e
jobgenerator:1.22
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.6.0-4
jsch:0.1.55.61.va_e9ee26616e7
junit:1119.1121.vc43d0fc45561
ldap:2.12
locale:180.v207501dff9b_a_
lockable-resources:2.16
login-theme:1.1
mail-watcher-plugin:1.17
mailer:435.v79ef3972b_5c7
mapdb-api:1.0.9-28.vf251ce40855d
mask-passwords:3.3
matrix-auth:3.1.5
matrix-project:772.v494f19991984
maven-plugin:3.19
mina-sshd-api-common:2.8.0-36.v8e25ce90d4b_1
mina-sshd-api-core:2.8.0-36.v8e25ce90d4b_1
momentjs:1.1.1
monitoring:1.91.0
msbuild:1.30
naginator:1.18.1
nodelabelparameter:1.11.0
okhttp-api:4.9.3-108.v0feda04578cf
pam-auth:1.10
parameterized-trigger:2.45
pipeline-build-step:2.18
pipeline-githubnotify-step:49.vf37bf92d2bc8
pipeline-graph-analysis:195.v5812d95a_a_2f9
pipeline-groovy-lib:612.v84da_9c54906d
pipeline-input-step:449.v77f0e8b_845c4
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2114.v2654ca_721309
pipeline-model-definition:2.2114.v2654ca_721309
pipeline-model-extensions:2.2114.v2654ca_721309
pipeline-rest-api:2.24
pipeline-stage-step:293.v200037eefcd5
pipeline-stage-tags-metadata:2.2114.v2654ca_721309
pipeline-stage-view:2.24
pipeline-utility-steps:2.13.0
plain-credentials:139.ved2b_9cf7587b
plot:2.1.11
plugin-usage-plugin:3.0
plugin-util-api:2.17.0
popper-api:1.16.1-3
popper2-api:2.11.6-1
port-allocator:1.8
prism-api:1.28.0-2
publish-over:0.22
repo:1.15.0
resource-disposer:0.19
rich-text-publisher-plugin:1.4
run-condition:1.5
scm-api:621.vda_a_b_055e58f7
script-security:1175.v4b_d517d6db_f0
sectioned-view:1.25
simple-theme-plugin:103.va_161d09c38c7
snakeyaml-api:1.30.2-76.vc104f7ce9870
sonar:2.14
ssh-agent:295.v9ca_a_1c7cc3a_a_
ssh-credentials:295.vced876c18eb_4
ssh-slaves:1.834.v622da_57f702c
sshd:3.242.va_db_9da_b_26a_c3
structs:324.va_f5d6774f3a_d
subversion:2.16.0
throttle-concurrents:2.8
timestamper:1.18
token-macro:308.v4f2b_ed62b_b_16
translation:1.16
trilead-api:1.67.vc3938a_35172f
uno-choice:2.6.3
variant:59.vf075fe829ccb
view-job-filters:2.3
warnings-ng:9.19.1
windows-slaves:1.8.1
workflow-aggregator:590.v6a_d052e5a_a_b_5
workflow-api:1192.v2d0deb_19d212
workflow-basic-steps:991.v43d80fea_ff66
workflow-cps:2759.v87459c4eea_ca_
workflow-durable-task-step:1199.v02b_9244f8064
workflow-job:1207.ve6191ff089f8
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:838.va_3a_087b_4055b
ws-cleanup:0.42
xunit:3.1.0

What Operating System are you using (both controller, and any agents involved in the problem)?

Docker

Reproduction steps

  1. In global configuration, Global Build Time Out is disabled
  2. Create a multi configuration build (matrix job)
  3. just do an "echo" step
  4. run the job

Expected Results

No log in Jenkins logs

Actual Results

Jenkins log:

Aug 29, 2022 2:15:31 PM WARNING hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration timeOutFor
testBuildTimeoutLogIssue#1 cannot allow individual jobs to overwrite timeout due to ClassCastException
java.lang.ClassCastException: class hudson.matrix.MatrixProject cannot be cast to class hudson.model.Project (hudson.matrix.MatrixProject is in unnamed module of loader jenkins.util.AntClassLoader @33fbe7d2; hudson.model.Project is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @19553973)
	at hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration.timeOutFor(GlobalTimeOutConfiguration.java:91)
	at hudson.plugins.build_timeout.global.GlobalTimeOutRunListener.setUpEnvironment(GlobalTimeOutRunListener.java:43)
	at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:615)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:483)
	at hudson.model.Run.execute(Run.java:1897)
	at hudson.matrix.MatrixBuild.run(MatrixBuild.java:323)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)

Anything else?

Seems since recent changes in GlobalTimeOutConfiguration, the plugin will raise a warning for any Matrix Project runs, even when it is not using the build timeout feature, as this type of job inherits from AbstractProject

Not sure how to fix this, probably needs an extra check...

Related to #97

Migrating from JUnit 4/3 to JUnit 5 for testing

What feature do you want to see added?

Currently the codebase uses JUnit 4 for testing. Would be ideal if the tests could be updated to use JUnit 5 for this plugin, in order to harness the latest features from Java 8 or later, such as the lambda functions, rendering the tests more powerful and easier to maintain.

More info about the major differences and benefits of migrating from JUnit 4 to JUnit 5 can be found for example in this blog post from Oracle.

Upstream changes

No response

How is Time-out variable supposed to work?

Describe your use-case which is not covered by existing documentation.

In the plugin configuration, there's the section "Time-out variable". My understanding was that I can use a Jenkins env variable, for example TIMEOUT=60, and assign this variable unter "Time-out variable". Consequently, I would when using strategy=Absolute not enter a value in "Timeout minutes". However, if I do this and leave the field empty, the job fails. How is "Time-out variable" supposed to work?

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Are you interested in contributing to the documentation?

No response

Set a default strategy on project configuration page

when enabling the build timeout on the project configuration page, no strategy is selected yet the configuration can be saved without a strategy. when a build is run a NullPointerException occurs. I think either a default strategy needs to be set or there needs to be some defensive code that tells the plugin to NOOP if no strategy is set?

Build Step `Run with timeout` is ignored if `Global Build Time Out` is activated

Jenkins and plugins versions report

Environment
Jenkins: 2.346.2
OS: Linux - 5.4.0-122-generic
---
ace-editor:1.1
analysis-model-api:10.16.0
ant:475.vf34069fef73c
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
authentication-tokens:1.4
bootstrap5-api:5.2.0-1
bouncycastle-api:2.26
branch-api:2.1046.v0ca_37783ecc5
build-publisher:1.22
build-timeout:1.21
built-on-column:1.1
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.7.5
cloud-stats:0.27
cloudbees-folder:6.740.ve4f4ffa_dea_54
command-launcher:84.v4a_97f2027398
conditional-buildstep:1.4.2
config-file-provider:3.11.1
copyartifact:1.47
credentials:1139.veb_9579fca_33b_
credentials-binding:523.vd859a_4b_122e6
data-tables-api:1.12.1-2
display-url-api:2.3.6
docker-commons:1.19
docker-java-api:3.2.13-37.vf3411c9828b9
docker-plugin:1.2.9
dtkit-api:3.0.1
durable-task:500.v8927d9fd99d8
echarts-api:5.3.3-1
email-ext:2.91
envinject:2.875.v9b_9e962da_a_ec
envinject-api:1.199.v3ce31253ed13
extended-read-permission:3.2
external-monitor-job:192.ve979ca_8b_3ccd
folder-properties:1.2.1
font-awesome-api:6.1.2-1
forensics-api:1.15.1
ghprb:1.42.2
git:4.11.4
git-client:3.11.2
github:1.34.5
github-api:1.303-400.v35c2d8258028
github-branch-source:1677.v731f745ea_0cf
gitlab-plugin:1.5.35
groovy:442.v817e6d937d6c
handlebars:3.0.8
htmlpublisher:1.30
jackson2-api:2.13.3-285.vc03c0256d517
jakarta-activation-api:2.0.1-1
jakarta-mail-api:2.0.1-1
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-4
javax-mail-api:1.6.2-7
jaxb:2.3.6-1
jdk-tool:55.v1b_32b_6ca_f9ca
jenkins-multijob-plugin:611.v9d3180d752e6
jersey2-api:2.36-2
jira:3.7.1
jjwt-api:0.11.5-77.v646c772fddb_0
jquery3-api:3.6.0-4
jsch:0.1.55.61.va_e9ee26616e7
junit:1119.1121.vc43d0fc45561
katalon:1.0.30
ldap:2.12
locale:180.v207501dff9b_a_
mailer:435.v79ef3972b_5c7
matrix-auth:3.1.5
matrix-project:772.v494f19991984
maven-plugin:3.19
metrics:4.2.10-389.v93143621b_050
mina-sshd-api-common:2.8.0-36.v8e25ce90d4b_1
mina-sshd-api-core:2.8.0-36.v8e25ce90d4b_1
momentjs:1.1.1
nexus-jenkins-plugin:3.14.431.v37ca_dc788b_b_1
nodelabelparameter:1.11.0
oic-auth:1.8
oidc-provider:18.v80b_cda_0cca_83
okhttp-api:4.9.3-108.v0feda04578cf
oracle-cloud-infrastructure-compute:1.0.16
pam-auth:1.10
parameterized-scheduler:1.0
parameterized-trigger:2.45
pipeline-build-step:2.18
pipeline-github-lib:38.v445716ea_edda_
pipeline-graph-analysis:195.v5812d95a_a_2f9
pipeline-groovy-lib:612.v84da_9c54906d
pipeline-input-step:449.v77f0e8b_845c4
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2114.v2654ca_721309
pipeline-model-definition:2.2114.v2654ca_721309
pipeline-model-extensions:2.2114.v2654ca_721309
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.24
pipeline-stage-step:293.v200037eefcd5
pipeline-stage-tags-metadata:2.2114.v2654ca_721309
pipeline-stage-view:2.24
plain-credentials:139.ved2b_9cf7587b
plugin-util-api:2.17.0
popper2-api:2.11.5-2
postbuildscript:3.1.0-375.v3db_cd92485e1
powershell:1.7
preSCMbuildstep:0.3
prism-api:1.28.0-2
prometheus:2.0.11
python:1.3
queue-cleanup:1.4
rebuild:1.34
resource-disposer:0.19
role-strategy:561.v9846c7351a_41
run-condition:1.5
scm-api:621.vda_a_b_055e58f7
script-security:1175.v4b_d517d6db_f0
shelve-project-plugin:3.2
snakeyaml-api:1.30.2-76.vc104f7ce9870
ssh-agent:295.v9ca_a_1c7cc3a_a_
ssh-credentials:295.vced876c18eb_4
ssh-slaves:1.834.v622da_57f702c
sshd:3.242.va_db_9da_b_26a_c3
structs:324.va_f5d6774f3a_d
throttle-concurrents:2.8
timestamper:1.18
token-macro:308.v4f2b_ed62b_b_16
trilead-api:1.67.vc3938a_35172f
validating-string-parameter:2.8
variant:59.vf075fe829ccb
versioncolumn:2.2
warnings-ng:9.18.0
windows-slaves:1.8.1
workflow-aggregator:590.v6a_d052e5a_a_b_5
workflow-api:1192.v2d0deb_19d212
workflow-basic-steps:991.v43d80fea_ff66
workflow-cps:2759.v87459c4eea_ca_
workflow-durable-task-step:1199.v02b_9244f8064
workflow-job:1207.ve6191ff089f8
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:838.va_3a_087b_4055b
ws-cleanup:0.42
xunit:3.1.0

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller: Linux - 5.4.0-122-generic (java11)
Agent: Linux (java8)

Reproduction steps

Configure Global Timeout in "Manage Jenkins > Configure System"

Bildschirmfoto 2022-08-20 um 13 37 07

I have some freestyle jobs, that take significantly longer. So i configured my job with a build step "Run with timeout" and execute a shell script in this build step:

Bildschirmfoto 2022-08-20 um 13 15 03


Same is reproducible instead of using the build step "run with timeout" but using the build environment "Terminate a build if it's stuck".

Expected Results

The timeout in the job configuration overwrites the global timeout.

Actual Results

The global timeout is always executed and the build terminates after 120 min.

Anything else?

No response

[Feture Request] Allow retrying a set number of times on timeout.

We have a build system that sometimes times out. However instead of restarting the whole pipeline it would be nice if we could give a limited number of retries, but only on timeout. Since most of the time it's the build system that just hangs, not an issue with the code.

However I'd like code issues to still fail the pipeline.

GlobalTimeOutConfiguration.timeOutFor Fails for Some Plugins

Jenkins and plugins versions report

Environment
Jenkins: 2.348
OS: Linux - 4.4.0-98-generic
---
Parameterized-Remote-Trigger:3.1.6.3
ace-editor:1.1
additional-metrics:45.vc0cdf94c7d5b_
ant:475.vf34069fef73c
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
authentication-tokens:1.4
blueocean:1.25.6
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.25.6
blueocean-commons:1.25.6
blueocean-config:1.25.6
blueocean-core-js:1.25.6
blueocean-dashboard:1.25.6
blueocean-display-url:2.4.1
blueocean-events:1.25.6
blueocean-git-pipeline:1.25.6
blueocean-github-pipeline:1.25.6
blueocean-i18n:1.25.6
blueocean-jira:1.25.6
blueocean-jwt:1.25.6
blueocean-personalization:1.25.6
blueocean-pipeline-api-impl:1.25.6
blueocean-pipeline-editor:1.25.6
blueocean-pipeline-scm-api:1.25.6
blueocean-rest:1.25.6
blueocean-rest-impl:1.25.6
blueocean-web:1.25.6
bootstrap4-api:4.6.0-5
bootstrap5-api:5.2.0-3
bouncycastle-api:2.26
branch-api:2.1046.v0ca_37783ecc5
build-timeout:1.21
build-token-root:151.va_e52fe3215fc
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.7.5
cloudbees-bitbucket-branch-source:785.ve724eb_44e286
cloudbees-folder:6.740.ve4f4ffa_dea_54
command-launcher:84.v4a_97f2027398
commons-lang3-api:3.12.0-36.vd97de6465d5b_
conditional-buildstep:1.4.2
config-file-provider:3.11.1
copyartifact:1.47
credentials:1139.veb_9579fca_33b_
credentials-binding:523.vd859a_4b_122e6
custom-job-icon:0.2
cvs:2.19.1
dashboard-view:2.447.vda_124dd35f11
display-url-api:2.3.6
docker-commons:1.19
docker-workflow:521.v1a_a_dd2073b_2e
durable-task:500.v8927d9fd99d8
echarts-api:5.3.3-1
external-monitor-job:192.ve979ca_8b_3ccd
favorite:2.4.1
font-awesome-api:6.1.2-1
ghprb:1.42.2
git:4.11.5
git-client:3.11.2
git-parameter:0.9.17
git-server:1.11
github:1.34.5
github-api:1.303-400.v35c2d8258028
github-branch-source:1687.v7618247e672d
gradle:1.39.4
greenballs:1.15.1
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
htmlpublisher:1.30
jackson2-api:2.13.3-285.vc03c0256d517
jacoco:3.3.2
jakarta-activation-api:2.0.1-1
jakarta-mail-api:2.0.1-1
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-4
javax-mail-api:1.6.2-7
jaxb:2.3.6-1
jdk-tool:55.v1b_32b_6ca_f9ca
jenkins-design-language:1.25.6
jersey2-api:2.36-2
jira:3.8
jjwt-api:0.11.5-77.v646c772fddb_0
jnr-posix-api:3.1.15-1
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.6.0-4
jsch:0.1.55.61.va_e9ee26616e7
junit:1119.1121.vc43d0fc45561
ldap:2.12
lockable-resources:2.16
mailer:435.v79ef3972b_5c7
mapdb-api:1.0.9-28.vf251ce40855d
matrix-auth:3.1.5
matrix-project:772.v494f19991984
maven-plugin:3.19
mercurial:2.16.2
mina-sshd-api-common:2.8.0-36.v8e25ce90d4b_1
mina-sshd-api-core:2.8.0-36.v8e25ce90d4b_1
momentjs:1.1.1
okhttp-api:4.9.3-108.v0feda04578cf
pam-auth:1.10
parameterized-trigger:2.45
pipeline-build-step:2.18
pipeline-graph-analysis:195.v5812d95a_a_2f9
pipeline-groovy-lib:612.v84da_9c54906d
pipeline-input-step:449.v77f0e8b_845c4
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2114.v2654ca_721309
pipeline-model-definition:2.2114.v2654ca_721309
pipeline-model-extensions:2.2114.v2654ca_721309
pipeline-rest-api:2.24
pipeline-stage-step:293.v200037eefcd5
pipeline-stage-tags-metadata:2.2114.v2654ca_721309
pipeline-stage-view:2.24
pitmutation:1.0-18
plain-credentials:139.ved2b_9cf7587b
plugin-util-api:2.17.0
popper-api:1.16.1-3
popper2-api:2.11.6-1
project-build-times:1.2.1
promoted-builds:881.vb_72da_69ffca_1
publish-over:0.22
publish-over-ssh:1.24
pubsub-light:1.16
rebuild:1.34
resource-disposer:0.19
run-condition:1.5
scm-api:621.vda_a_b_055e58f7
script-security:1175.v4b_d517d6db_f0
simple-theme-plugin:103.va_161d09c38c7
sloccount:1.26
snakeyaml-api:1.30.2-76.vc104f7ce9870
sse-gateway:1.25
ssh-agent:295.v9ca_a_1c7cc3a_a_
ssh-credentials:295.vced876c18eb_4
ssh-slaves:1.834.v622da_57f702c
sshd:3.242.va_db_9da_b_26a_c3
structs:324.va_f5d6774f3a_d
subversion:2.16.0
timestamper:1.18
token-macro:308.v4f2b_ed62b_b_16
translation:1.16
trilead-api:1.67.vc3938a_35172f
uithemes:2.1.1
variant:59.vf075fe829ccb
windows-slaves:1.8.1
workflow-aggregator:590.v6a_d052e5a_a_b_5
workflow-api:1192.v2d0deb_19d212
workflow-basic-steps:991.v43d80fea_ff66
workflow-cps:2759.v87459c4eea_ca_
workflow-durable-task-step:1199.v02b_9244f8064
workflow-job:1207.ve6191ff089f8
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:838.va_3a_087b_4055b
ws-cleanup:0.42

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux

Reproduction steps

  1. Set up a promotion for a project, using the Promoted Builds plugin.
  2. Promote a build.

Expected Results

The promotion is executed.

Actual Results

The promotion is not executed. The console contains an exception with a stack trace:

FATAL: class hudson.plugins.promoted_builds.PromotionProcess cannot be cast to class hudson.model.Project (hudson.plugins.promoted_builds.PromotionProcess is in unnamed module of loader jenkins.util.URLClassLoader2 @1a5fcf8; hudson.model.Project is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @313b2ea6)
java.lang.ClassCastException: class hudson.plugins.promoted_builds.PromotionProcess cannot be cast to class hudson.model.Project (hudson.plugins.promoted_builds.PromotionProcess is in unnamed module of loader jenkins.util.URLClassLoader2 @1a5fcf8; hudson.model.Project is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @313b2ea6)
	at hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration.timeOutFor(GlobalTimeOutConfiguration.java:88)
	at hudson.plugins.build_timeout.global.GlobalTimeOutRunListener.setUpEnvironment(GlobalTimeOutRunListener.java:43)
	at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:615)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:483)
	at hudson.model.Run.execute(Run.java:1897)
	at hudson.model.Run.run(Run.java:1851)
	at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:317)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)

Anything else?

Apparently, some projects are not actually projects…

https://github.com/jenkinsci/promoted-builds-plugin/blob/d3e416119f30d0f65c2f2c153d3fde37bc90a598/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java

PromotionProcess inherits from AbstractProject which is not a Project. However, GlobalTimeOutConfiguration expects every project to actually implement Project.

Downgrading the Build Timeout plugin to 1.21 makes the promotion work again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.