Skip to content

Instantly share code, notes, and snippets.

@nolte
Created June 22, 2017 19:23
Show Gist options
  • Save nolte/be1b70bb60e2e8d89e4b6c5d2a318621 to your computer and use it in GitHub Desktop.
Save nolte/be1b70bb60e2e8d89e4b6c5d2a318621 to your computer and use it in GitHub Desktop.
List all installed Jenkins Extension
import jenkins.model.*;
import hudson.ExtensionFinder;
List<ExtensionFinder> finders = Jenkins.instance.getExtensionList(ExtensionFinder.class);
for (finder in finders) {
println(">>> " + finder);
if (finder instanceof hudson.ExtensionFinder.GuiceFinder) {
println(finder.annotations.size());
for (key in finder.annotations.keySet()) {
println(key);
}
} else if (finder instanceof hudson.cli.declarative.CLIRegisterer) {
println(finder.discover(Jenkins.instance));
for (extension in finder.discover(Jenkins.instance)) {
println("CLI wrapper for " + extension.instance.class);
// not sure what to do with those
}
} else {
println("UNKNOWN FINDER TYPE");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment