Created
September 9, 2013 12:52
-
-
Save dbr/6495186 to your computer and use it in GitHub Desktop.
Delete failed builds for a job in Jenkins
This file contains hidden or 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 job = Jenkins.instance.getItem("the_job_name") | |
job.getBuilds().each { | |
if(it.result == Result.FAILURE){ | |
// Delete failed job | |
it.delete() | |
} | |
} |
That is because of the folder in the name, not only for multibranch.
So getItemByFullName
is needed whenever you have folders.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had some issues with this. on multibranch pipelines Using
getItemByFullName
instead worked