In Jenkins, I looking for the Groovy script in which I want to list all Jenkins jobs/pipelines active and disable jobs/pipelines and also count and exclude active and disabled multibranch jobs/branches using the Groovy script.
I have tried a couple of Groovy scripts to get all the jobs, and those are working fine, but here the catch is I'm able to all active and disabled jobs list and count as well, but not able to exclude active and disabled multibranch jobs.
Now I want to get the count of all Jobs without folders and subfolders.
The groovy script I have tried to the all jobs list including folder and subfolders is below
Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class
}
I need only active jobs/pipelines which are WorkflowJob, FreestyleProject but exclude active and disabled multibranch jobs/branches
Someone please can help on or guide me on this, help is very much appreciated