Created
October 8, 2017 21:24
-
-
Save managedkaos/11a807fef21f5e75bb661b2d34aeea29 to your computer and use it in GitHub Desktop.
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
/usr/local/bin/docker stop ${CONTAINER_NAME} || echo "no container to stop" | |
/usr/local/bin/docker rm ${CONTAINER_NAME} || echo "no container to remove" | |
# the insecure, no plugins install (skips the setup wizard) | |
/usr/local/bin/docker run \ | |
-e 'JAVA_OPTS="-Djenkins.install.runSetupWizard=false"' \ | |
--detach \ | |
--publish ${PORT_NUMBER}:8080 \ | |
--name ${CONTAINER_NAME} jenkins | |
# stand around while the app boots up | |
sleep 10 | |
# list the default plugins | |
DEFAULT_PLUGINS="\ | |
email-ext \ | |
mailer \ | |
ant \ | |
antisamy-markup-formatter \ | |
build-timeout \ | |
cloudbees-folder \ | |
credentials-binding \ | |
git \ | |
github-organization-folder \ | |
gradle \ | |
ldap \ | |
matrix-auth \ | |
pam-auth \ | |
pipeline-stage-view \ | |
ssh-slaves \ | |
subversion \ | |
timestamper \ | |
workflow-aggregator \ | |
ws-cleanup \ | |
" | |
for plugin in $DEFAULT_PLUGINS; | |
do | |
curl -s -X POST \ | |
--data "<jenkins><install plugin='${plugin}@latest' /></jenkins>" \ | |
--header 'Content-Type: text/xml' \ | |
http://localhost:49000/pluginManager/installNecessaryPlugins | |
done | |
# download the hello-world job | |
curl -s https://gist.githubusercontent.com/managedkaos/8c5ee0ee4d0f6a62985f027896f931a1/raw/5a6b466feeaffb0592b3919d072fbeb72b4b9d92/config.xml > config.xml | |
# install the job and restart | |
/usr/local/bin/docker exec jenkins mkdir var/jenkins_home/jobs/hello-world | |
/usr/local/bin/docker cp config.xml jenkins:/var/jenkins_home/jobs/hello-world | |
/usr/local/bin/docker restart jenkins | |
# stand around while the app boots up | |
sleep 10 | |
# run the hello-world job | |
curl -s -X POST http://localhost:${PORT_NUMBER}/job/hello-world/build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment