Reputation: 2444
Is there a way to get a list of Jenkins jobs that are NOT using the "Discard Old Builds" option?
I found a few jobs that people have created that are NOT using this plugin and I'm trying to enforce the usage of it:
Upvotes: 1
Views: 328
Reputation: 791
How about following these steps:
<jenkins_url>/api/json?tree=jobs[name,url]
<jenkins_url>/job/<job_name>/config.xml
xpath=//properties/jenkins.model.BuildDiscarderProperty
There could be much more efficient ways to do it too!
Upvotes: 1
Reputation: 2312
You will have to use Jenkins API(I've used JSON api for e.g.) and look for the below property
"property" : [
{
"_class" : "jenkins.model.BuildDiscarderProperty"
}
],
If present it indicates that Discard old Builds is checked.
So you can iterate through all the jobs and the job that don't have this property is your culprits.
Hope this helps :)
Upvotes: 0