Jenkins Groovy script: List all jobs
AnsweredI need to find create a Jenkins job which counts and lists all jobs
0
-
Official comment
This script will provide that information for you:
Jenkins.instance.getAllItems(AbstractItem.class).eachWithIndex{ it, index ->
if(it == Jenkins.instance.getAllItems(AbstractItem.class).last()) {
println(index + " total jobs\n")
}
}
Jenkins.instance.getAllItems(AbstractItem.class).each{
println(it.fullName)
}For more context - https://support.cloudbees.com/hc/en-us/articles/226941767-Groovy-to-list-all-jobs
-
Thanks Ryan.
I am sorry . I need a script to count the number of Jenkins Jobs.
0 -
If you navigate to the Manage Jenkins -> Script Console page on your Jenkins master, copy/paste the Groovy script in my previous comment, and run the script - you will see the number of jobs as well as the list of jobs.
0 -
how to copy a folder to another location of the folder
0
Please sign in to leave a comment.
Comments
4 comments