Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/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