Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AaronDMarasco-VSI/6dff0eabac9b4fec31b60dc443eec2bc to your computer and use it in GitHub Desktop.
Save AaronDMarasco-VSI/6dff0eabac9b4fec31b60dc443eec2bc to your computer and use it in GitHub Desktop.
Stop running Jenkins jobs (not queued)
// Not sure if this worked or timed out...
def buildingJobs = Jenkins.instance.getAllItems(Job.class).findAll { it.isBuilding() }
buildingJobs.each { job->
if (job.name =~ /build_assets/) {
println(job.name)
job._getRuns()[-1].doStop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment