Advertisement
mindthump

Running Jenkins Jobs with duration

Aug 30th, 2022 (edited)
3,440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.39 KB | None | 0 0
  1. import jenkins.model.Jenkins
  2. import java.util.concurrent.TimeUnit
  3.  
  4. String findRunningPipelineJobs() {
  5.     Jenkins.instance.getComputer('').getOneOffExecutors().collect {
  6.         "${Jenkins.instance.rootUrl}${it.currentExecutable.url} | ${TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - it.currentExecutable.startTimeInMillis)}"
  7.     }.join('\n')
  8. }
  9.  
  10. println findRunningPipelineJobs()
Tags: Jenkins
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement