Skip to content

Instantly share code, notes, and snippets.

@daxroc
Created October 12, 2017 10:41
Show Gist options
  • Save daxroc/241175874e5408a15cfbd9e3563a8666 to your computer and use it in GitHub Desktop.
Save daxroc/241175874e5408a15cfbd9e3563a8666 to your computer and use it in GitHub Desktop.
import org.yaml.snakeyaml.Yaml
Yaml yaml = new Yaml()
def plugins = Jenkins.instance.pluginManager.plugins
def output = []
def dependencies = []
plugins.each { p ->
// println p.getProperties().toString()
def name = p.shortName
def version = p.version
if(!(name in dependencies)){
output << ["name": name, "version": version]
}
p.dependencies.each { d ->
dependencies << d.shortName // d.version
}
}
def yml =["jenkins":["plugins": output.sort { a, b -> a.name <=> b.name } ]]
println yaml.dump(yml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment