├── .gitignore ├── README.md ├── data └── jenkins │ └── .keep ├── djs.sh ├── master ├── Vagrantfile └── setup.sh └── slaves ├── add_slave.sh ├── build.sh ├── centos5 ├── Dockerfile ├── add_slave.sh ├── build.sh └── stop_slave.sh ├── centos6-java ├── Dockerfile ├── add_slave.sh ├── build.sh ├── resources │ └── known_hosts └── stop_slave.sh ├── centos6 ├── Dockerfile ├── add_slave.sh ├── build.sh └── stop_slave.sh ├── centos7-java ├── Dockerfile ├── README.md ├── add_slave.sh ├── build.sh └── stop_slave.sh ├── common.sh ├── local_settings.sh ├── squeeze ├── Dockerfile ├── add_slave.sh ├── build.sh └── stop_slave.sh ├── stop_slaves.sh └── suse12 ├── Dockerfile ├── add_slave.sh ├── build.sh └── stop_slave.sh /.gitignore: -------------------------------------------------------------------------------- 1 | nohup.out 2 | 3 | authorized_keys 4 | id_rsa 5 | id_rsa.pub 6 | 7 | .vagrant 8 | data 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Jenkins-on-Vagrant-with-Docker-Slaves 2 | ======================================= 3 | 4 | Prerequisites 5 | ------------- 6 | 1. Vagrant 7 | 8 | Optional (but is really recommended) 9 | 10 | 1. vagrant-lxc plugin: `vagrant plugin install vagrant-lxc` 11 | 2. vagrant-lxc related configuration on Host. See https://github.com/fgrehm/vagrant-lxc/wiki 12 | 13 | Getting started 14 | ------------- 15 | $ git clone git@github.com:rrader/docker-jenkins-slave.git djs 16 | $ cd djs 17 | $ ./djs.sh up 18 | [lots of vagrant output ....] 19 | ================================================== 20 | Jenkins should be available on 10.0.3.74:8080 21 | Start using slaves with adding one 22 | e.g. # ./djs.sh add centos7-java Luke 23 | 24 | Now you should be able to use your just deployed jenkins on http://10.0.3.74:8080 or similar 25 | 26 | Now let's add some slaves with `./djs.sh add ` 27 | 28 | $ ./djs.sh add centos7-java Luke 29 | Unable to find image 'antigluk/jenkins-slave-centos6-java' locally 30 | Pulling repository antigluk/jenkins-slave-centos6-java 31 | [lots of docker output ....] 32 | Status: Downloaded newer image for antigluk/jenkins-slave-centos6-java:latest 33 | 507e2a18674253d0d7d1f5201ee963681704c2d18310af619f9fcbb0124efaf3 34 | Connection to 10.0.3.74 closed. 35 | 36 | This will pull centos7-java image from Docker Hub and start it. After this command ends you should be able to see Luke worker in "Build Executor Status" section on Jenkins. 37 | 38 | 39 | Notes [important] 40 | ============ 41 | Only centos6-java and centos7-java are ready to use now with Vagrant Jenkins 42 | 43 | 44 | docker-jenkins-slave [DEPRECATED] 45 | =================================== 46 | This section describes how to build and use slaves without Vagrant, as it were in version 1.x. 47 | 48 | CentOS 5, 6, Suse12 and Debian Jenkins slaves based on Docker 49 | 50 | Install 51 | -------------------- 52 | 53 | 1. Clone this repository 54 | 2. Install Swarm Plugin to your Jenkins 55 | 3. Go to subfolder of desired slave OS (centos5, squeeze etc) 56 | 4. Do `$ sudo bash build.sh` 57 | 58 | Usage 59 | -------------------- 60 | 61 | 1. Go to subfolder of desired slave OS (centos5, squeeze etc), again 62 | 2. Do `$ sudo bash add_slave.sh SlaveName` (it assumes that docker machine sees host as 172.17.42.1) 63 | 3. In Jenkins now you should see new slave, modify or create new job and specify tag `docker-` (see list of tagnames on wiki) 64 | -------------------------------------------------------------------------------- /data/jenkins/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rrader/docker-jenkins-slave/e0949de7bcc94423e1c7641033a533b769560542/data/jenkins/.keep -------------------------------------------------------------------------------- /djs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JENKINS_PORT=8080 4 | 5 | show_help() { 6 | echo "Jenkins-In-Container Management" 7 | echo " -h show this help" 8 | echo 9 | echo "Available commands:" 10 | echo " up" 11 | echo " build