This is a docker implementation of fli4l buildroot buildnode for Jenkins.
For more information please refer to Official website or Support forum
This instruction works for a Centos7 docker host. Other distributions may need some adjustments.
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
...
sudo yum install docker-engine -y
...
sudo systemctl enable docker.service
...
sudo systemctl start docker.service
You now have two options:
- Build from scratch or
- Pull the ready-made image from DockerHub.
sudo docker pull starwarsfan/fli4l-buildroot-buildnode
sudo git clone https://github.com/starwarsfan/fli4l-buildroot-buildnode.git
cd fli4l-buildroot-buildnode
sudo docker build -t starwarsfan/fli4l-buildroot-buildnode:latest .
sudo docker run \
--name fli4l-buildroot-buildnode** \
-d \
starwarsfan/fli4l-buildroot-buildnode:latest
There are the following mountpoints available:
- /data/work/
- /data/shared/fli4l/
- /home/jenkins/.ssh/
These mountpoints can be used to mount folders from the host or other volumes to store informations which should be persistant or should not everytime be recreated.
With the additional run parameter -v :/data/work/ you can mount a folder on the docker host which contains persistant data. So the run command may look like the following example:
sudo docker run \
--name fli4l-buildroot-buildnode \
-v /data/svn-checkout/:/data/work/ ...
The container could be startet with some of the following options. These list contains the default values, which could be overwritten on the docker run command:
- JENKINS_URL=http://localhost
- JENKINS_TUNNEL=
- JENKINS_USERNAME=admin
- JENKINS_PASSWORD=admin
- EXECUTORS=1
- DESCRIPTION=Swarm node with fli4l buildroot
- LABELS=linux swarm fli4l-buildroot
- NAME=generic-swarm-node
sudo docker run \
--name fli4l-buildroot-buildnode \
-e "JENKINS_URL=https://jenkins.foobar.org" \
-e "JENKINS_PASSWORD=123456" ...
The option JENKINS_TUNNEL might be neccessary if Jenkins is running behind a reverse proxy as the JNLP connection could not be established in such a setup. You need to configure the following on Jenkins:
- Configuration > Global Security > Agents
- Set TCP port for JNLP agents to Static
- Enter a port number like 32775
- Save configuration
Assumed your Jenkins is available on https://jenkins.foobar.org, the host has the ip 10.20.30.40 and you configured the JNLP port 32775, you need to start the container with at least these options:
sudo docker run \
--name fli4l-buildroot-buildnode \
-e "JENKINS_URL=https://jenkins.foobar.org" \
-e "JENKINS_TUNNEL=10.20.30.40:32775" ...
Check running / stopped container:
sudo docker ps -a
Stop the container
sudo docker stop fli4l-buildroot-buildnode
Start the container
sudo docker start fli4l-buildroot-buildnode
Get logs from container
sudo docker logs -f fli4l-buildroot-buildnode
Open cmdline inside of container
sudo docker exec -i -t fli4l-buildroot-buildnode /bin/bash