Skip to content

Instantly share code, notes, and snippets.

@seanf
seanf / jenkins-ensure-timeout.groovy
Last active September 27, 2022 11:00
Jenkins Groovy script: sets a timeout strategy for any job which doesn't have one
// This script is for Jenkins' Groovy console, and sets a timeout
// strategy for any job which doesn't have one.
// Based on http://janmaterne.wordpress.com/2010/07/11/how-to-check-if-all-hudson-jobs-have-a-timeout/
// Updated and modified by Sean Flanigan.
import hudson.model.*
String describe(strat) {
if (strat instanceof hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy) {
return "Elastic(${strat.timeoutPercentage}, ${strat.numberOfBuilds}, ${strat.timeoutMinutesElasticDefault})"
@larrycai
larrycai / README.markdown
Last active September 16, 2022 03:59
check the plugin usage in jenkins