Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Last active June 21, 2021 13:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellyrob99/1907283 to your computer and use it in GitHub Desktop.
Save kellyrob99/1907283 to your computer and use it in GitHub Desktop.
Install a suite of plugins in a locally running Jenkins/Hudson server and restart it.`
@GrabResolver(name='glassfish', root='http://maven.glassfish.org/content/groups/public/')
@GrabResolver(name='jenkins', root='http://maven.jenkins-ci.org/content/repositories/releases')
@GrabResolver(name="github", root="http://kellyrob99.github.com/Jenkins-api-tour/repository")
@Grab('org.kar:hudson-api:0.2-SNAPSHOT')
@GrabExclude('org.codehaus.groovy:groovy')
import static java.net.HttpURLConnection.*
import org.kar.hudson.api.*
import org.kar.hudson.api.cli.HudsonCliApi
String rootUrl = 'http://localhost:8080'
HudsonCliApi cliApi = new HudsonCliApi()
['groovy', 'gradle', 'chucknorris', 'greenballs', 'github', 'analysis-core', 'analysis-collector', 'cobertura',
'project-stats-plugin','audit-trail', 'view-job-filters', 'disk-usage', 'global-build-stats',
'radiatorviewplugin', 'violations', 'build-pipeline-plugin', 'monitoring', 'dashboard-view',
'iphoneview', 'jenkinswalldisplay'].each{ plugin ->
cliApi.runCliCommand(rootUrl, ['install-plugin', plugin])
}
// Restart a node, required for newly installed plugins to be made available.
cliApi.runCliCommand(rootUrl, 'safe-restart')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment