Created
December 30, 2013 14:36
-
-
Save basmussen/8182784 to your computer and use it in GitHub Desktop.
Install Jenkins plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
host=http://localhost:8080 | |
url=/pluginManager/installNecessaryPlugins | |
# git plugin https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin | |
curl -X POST -d '<jenkins><install plugin="[email protected]" /></jenkins>' --header 'Content-Type: text/xml' $host$url | |
# artifactory plugin https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin | |
curl -X POST -d '<jenkins><install plugin="[email protected]" /></jenkins>' --header 'Content-Type: text/xml' $host$url | |
# wait 20 sec | |
sleep 20 | |
# jenkins safe restart | |
curl -X POST $host/safeRestart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I kept trying this with Jenkins 2.145 but just getting redirected to the updateCenter page and never actually triggering a plugin installation. After much looking I found a comment where somebody mentioned you don't need the XML data and can just pass a form submission of
-F "plugin.$PLUGIN.default=on"
to$JENKINS_HOST/pluginManager/install
and it will trigger the installation. I haven't tested passing multiple plugins at once yet, but the$PLUGIN
bit is simply the 'short name' of the plugin which is what is most often used anyways. Because it uses updateCenter you probably can't pass a specific version (updateCenter always pulls latest), but I haven't fully experimented with all the options.