Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This scripts displays a list of all failed jobs. Addon: restart them.

activeJobs = hudson.model.Hudson.instance.items.findAll{job -> job.isBuildable()}
failedRuns = activeJobs.findAll{job -> job.lastBuild != null && job.lastBuild.result == hudson.model.Result.FAILURE}
failedRuns.each{run -> println(run.name)}

Sample ouput produced:

Result: [hudson.model.FreeStyleProject@1f39c59[ProjectA], hudson.model.FreeStyleProject@16a93b8[ProjectB], hudson.model.FreeStyleProject@12947ee[ProjectC]]


If you have a list of failed jobs you also could do other things than just printing them. FThe key is changing the last closure.

Addon: Restart

startServer = "admin computer"
startNote   = "bulk start"
cause = new hudson.model.Cause.RemoteCause(startServer, startNote)
joblist.each{run -> run.scheduleBuild(cause)}
  • No labels