dockered_jenkins
Ephemeral Build Slaves using Jenkins and Docker
This repo all the files necessary to create your own local Docker-Toolbox version of a fully ephemeral jenkins environment. Build slaves are designed to be docker containers in this configuration. The only thing missing to make it work is your Docker Machine certs (see directions below on how to add these).
Quick Start
- Make sure you have all the pre-reqs installed (i.e. Docker-toolbox) Ubuntu install is here https://docs.docker.com/engine/installation/linux/ubuntulinux/
- Clone this repository to your local drive
- Find the docker-machine folder container your 4 client pem keys (ca-key.pem, ca.pem, key.pem, cert.pem). Mine for example, is in ~/.docker/machine/certs.
- cp -R yourdockermachinecertsfolder jenkins-master/certs
- make build
- make run
- Point your browser to http://yourdockermachineip
- In jenkins, configure a ssh-key pair using an ssh private key for the user "jenkins". As the private key, use the file in jenkins-slave/files/dummy_private_rsa_key
- In jenkins, configure a Docker Certificates Directory credential using /usr/local/etc/jenkins/certs as the source directory
- In jenkins configuration, add a new Docker cloud provider
- Set host to https://yourdockermachineip:2376
- Select the docker certificates directory you made
- Set read timeout to 5
- set connection timeout to 15
- Click on "Test Connection" and make sure you get a valid response
- In jenkins config on your new Docker cloud add a Docker template
- Set the image name to: jenkins_slave
- Create a label "testslave"
- Make sure credentials are your new ssh key pair you made above
- Click "Save"
- Create a new free-style jenkins job
- Restrict the job to the label "testslave"
- Add a build step, like execute shell "echo 'Hello World!'"
- Save job
- Run job
If everything is configured correctly your job should dynamically allocate a slave, run itself and then de-allocate the slave.
Jenkins-slave
A docker image to be used for Jenkins testing
This image provides
- Languages
- JDK 1.7, 1.8 / Maven 3.3.4
- Node 0.10.24 via nvm
- Ruby 2.2.4 via RVM
- Services
- Postgres 9.3
- Xvfb
- Browsers
- Firefox
- Chrome-beta
- Chromium
Environment Variables
JAVA_OPTS
, Default:-Xmx2G -Xms2G -XX:PermSize=256M -XX:MaxPermSize=256m
DISPLAY
, Default:10
XVFB_SCREEN_SIZE
, Default1024x768x24
Examples
BUILD_TAG
andWORKSPACE
are jenkins environment variables.