Created
November 21, 2016 17:30
-
-
Save aheritier/aed3b0c7098c2f06b8a10ff1e99d44ae to your computer and use it in GitHub Desktop.
Find Pipeline Scripts running for more than 1 day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.time.* | |
println "List of running jobs : " | |
use(TimeCategory) { | |
Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob).each{ | |
job -> job.builds.findAll{it.isBuilding() && new Date(it.startTimeInMillis) < (new Date() - 1.day) }.each{ | |
build -> | |
TimeDuration duration = TimeCategory.minus(new Date(), new Date(build.startTimeInMillis)) | |
println "* $job.fullName#$build.number started since $duration" | |
} | |
} | |
} | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment