Skip to content

Instantly share code, notes, and snippets.

@aespinosa
Created October 21, 2014 13:46
Show Gist options
  • Save aespinosa/ea9326cc9fa9c6dd9e71 to your computer and use it in GitHub Desktop.
Save aespinosa/ea9326cc9fa9c6dd9e71 to your computer and use it in GitHub Desktop.
all-in-one Jenkins configuration
import jenkins.model.*;
pm = Jenkins.instance.pluginManager
pm.doCheckUpdatesServer()
plugins = pm.plugins
# FIXME idempotency needed here
plugins.each {
if (it.isEnabled()) {
it.disable()
}
}
# Idempotency check
if (! pm.getPlugin("git") {
deployment = Jenkins.instance.updateCenter.getPlugin("git").deploy(true)
deployment.get()
}
def deployPlugin(plugin) {
if (! plugin.isEnabled() ) {
plugin.enable()
}
plugin.getDependencies().each {
deployPlugin(pm.getPlugin(it.shortName))
}
}
plugin = pm.getPlugin("git")
deployPlugin(plugin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment