Issue
- I want to know how many freestyle/maven/pipeline jobs there are in Jenkins.
Environment
- CloudBees CI (CloudBees Core)
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
- CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
- CloudBees CI (CloudBees Core) on traditional platforms - Client controller
- CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
- CloudBees Jenkins Enterprise
- CloudBees Jenkins Enterprise - Managed controller
- CloudBees Jenkins Enterprise - Operations Center
- CloudBees Jenkins Platform - Client controller
- CloudBees Jenkins Platform - Operations Center
- CloudBees Jenkins Distribution
- Jenkins LTS
Resolution
Using Groovy Script
You can run a script from the Groovy Script Console under Manage Jenkins –> Script Console:
Set<String> jobTypes = new HashSet<String>();
Jenkins.instance.allItems(AbstractItem.class).each {
jobTypes.add(it.class)
}
jobTypes.each { clazz ->
println clazz.getCanonicalName() + ": " + Jenkins.instance.getAllItems(clazz).size()
}
println "--------------------------------------------------------------------------"
println "Total items : " + Jenkins.instance.getAllItems(AbstractItem.class).size()
return
Other useful groovy scripts can also be found in:
Using Support Bundle
You can also find the job statistics from the support bundle. Here is how:
1) Install the Support Core Plugin (see What is a support-bundle and how to create one).
2) Generate a support bundle.
3) Unzip the file
4) Aggregate job type statistics can be found under the root folder in items.md
file.
Tested product/plugin versions
- CloudBees Jenkins 2.176.2.3
- CloudBees Support Plugin 3.22
0 Comments