Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Created February 25, 2012 06:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellyrob99/1907114 to your computer and use it in GitHub Desktop.
Save kellyrob99/1907114 to your computer and use it in GitHub Desktop.
Jenkins/Hudson recipe for updating all Plugins using the CLI
def findPluginsWithUpdates = '''
Hudson.instance.pluginManager.plugins.inject([]) { List toUpdate, plugin ->
if(plugin.hasUpdate())
{
toUpdate << plugin.shortName
}
toUpdate
}.inspect()
'''
OutputStream updateablePlugins = new ByteArrayOutputStream()
cliApi.runCliCommand(rootUrl, ['groovysh', findPluginsWithUpdates], System.in, updateablePlugins, System.err)
def listOfPlugins = Eval.me(parseOutput(updateablePlugins.toString()))
listOfPlugins.each{ plugin ->
cliApi.runCliCommand(rootUrl, ['install-plugin', plugin])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment