Skip to content

Instantly share code, notes, and snippets.

@macg33zr
Last active September 29, 2017 15:16
Show Gist options
  • Save macg33zr/9d9d5885084ea855c3703c868b1609ed to your computer and use it in GitHub Desktop.
Save macg33zr/9d9d5885084ea855c3703c868b1609ed to your computer and use it in GitHub Desktop.
Bill's Jenkins System Groovy Script KB gist
//
// Custom tools
//
import com.cloudbees.jenkins.plugins.customtools.CustomTool
import hudson.tools.InstallSourceProperty
import hudson.tools.ZipExtractionInstaller
def tools = Jenkins.instance.getDescriptorByType(CustomTool.DescriptorImpl.class)
tools.metaClass.methods*.name.sort().unique()
def installations = tools.getInstallations()
installations.each { tool ->
println "Got tool: ${tool}"
// Is it a custom tool
if (tool instanceof CustomTool) {
println "Custom tool: yes"
println "Name: ${tool.name}"
tool.getProperties().each { prop ->
println "tool property: ${prop}"
if (prop instanceof InstallSourceProperty) {
prop.installers.each { installer ->
println "Installer : ${installer}"
if (installer instanceof ZipExtractionInstaller) {
println "Installer URL: ${installer.getUrl()}"
println "Installer DIR: ${installer.getSubdir()}"
}
}
}
println "-------------------------------------------------------------\r\n"
}
}
}
What is going on here with gists and multi files?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment