Is there any workaround that I can retrieve the Build Environment settings for every job in a groovy script ? For example I installed the 'Scriptler plugin' and the 'EnvInject plugin' and I want to find out for every job that I have if "manage exclusion" is ticked or not :
what I did is:
println String.format( "<b>List of JOBS :</b>" )`
println ''
for(item in jenkins.model.Jenkins.instance.getAllItems(hudson.model.Job.class))
{
if(item instanceof hudson.model.ExternalJob)
continue
println''
for (env in item.builders)
println env
}
I just found out how to do it...
println ''
println String.format( "<b> List all JOBS having exclusions defined :</b>" )
println ''
for(item in jenkins.model.Jenkins.instance.getAllItems(hudson.model.Job.class))
{
if(item instanceof hudson.model.ExternalJob)
continue
for(wrapper in item.getBuildWrappersList())
if (wrapper instanceof org.jvnet.hudson.plugins.exclusion.IdAllocator)
println item.name
}
To sum up......the changes that I did,I called the getBuildWrappersList to retrieve the Build Environment parameters.For my case,I was trying to find out which jobs were using the ArchiveArtifact plugin and display them for the user...
Cheers :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.