-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathgetScriptletJobBuilders.groovy
More file actions
40 lines (33 loc) · 952 Bytes
/
Copy pathgetScriptletJobBuilders.groovy
File metadata and controls
40 lines (33 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*** BEGIN META {
"name" : "getScriptletJobBuilders",
"comment" : "Print usage of Groovy SCRIPTLETS in ALL JOB BUILDERS by searching JENKINS model",
"parameters" : [ 'scriptNameList'],
"core": "2.121",
"authors" : [
{ name : "Ioannis K. Moutsatsos" }
]
} END META**/
import hudson.model.*
//scriptNameList='copyServerStaticArtifact,Delete_JobSessionWorkspace,dataTableMaker'
scriptMap=[:]
scriptNameList.split(',').each{script->
scriptJob=[]
//all job name
jenkins.model.Jenkins.instance.getAllItems(FreeStyleProject.class).each {
it.getBuilders().each{bld->
//println bld.getClass()
if (bld.getClass()==org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder){
if (bld.getScriptId()-'.groovy'==script){
bld.getDescriptor()
scriptJob.add(it.name)
}
}
}
}
println script
scriptJob.each{j->
println '\t'+j
}
scriptMap.put(script,scriptJob)
} //end each script
return null //scriptMap