Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcosborges/443add5829b914ffc04ef2445c55e318 to your computer and use it in GitHub Desktop.
Save marcosborges/443add5829b914ffc04ef2445c55e318 to your computer and use it in GitHub Desktop.
def total = 0
def findInScript = ""
def findInName = ""
Jenkins.getInstance().getAllItems().each {
if(it?.getDescriptor().getDisplayName() == "Pipeline") {
if (
it.getDefinition()?.getScript()?.contains(findInScript) &&
it.getFullName().contains(findInName)
){
println "${it.getFullName()}"
total++
}
}
}
total
@user-muthu
Copy link

getting error
[test] $ groovy C:\Jenkins\workspace\test\hudson6410766321823746284.groovy
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "groovy" (in directory "C:\Jenkins\workspace\test"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)

@marcosborges
Copy link
Author

Hi @mydearmuthu1978
This script is to be run in the Jenkins script console. It is in the management area near the end of the items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment