Created
January 26, 2021 22:23
-
-
Save imander/219c1f1e46aa7b750ec02d1b639ba8ce to your computer and use it in GitHub Desktop.
Delete all failed Jenkins Jobs
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
def jobnames = Jenkins.instance.getJobNames() | |
jobnames.each { | |
println("Checking Job: ${it}"); | |
def job = Jenkins.instance.getItemByFullName(it) | |
job.getBuilds().each { | |
if (it.result == Result.FAILURE) { | |
// Delete failed job | |
it.delete() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment