Collection of executable Jenkinsfiles loaded automatically into a dockerized Jenkins. Useful for experimenting or demos.
Jenkinsfile documentation lacks in examples when it comes to more advanced features.
I needed working examples of various Jenkinsfiles which I could then modify in my local text editor and automatically convert them into Jenkins jobs.
Unfortunately the best way to test a Jenkinsfile is to run it in a Jenkins instance.
This project takes away the manual process of copying and pasting a Jenkinsfile into a Jenkins job configuration.
By design job has to be run manually.
This will pull and start latest docker images
docker-compose pull
docker-compose up
If you have problem with mounting /var/run/docker.sock
then remove it from docker-compose.yml
but you won't be able to run jobs which use docker as an agent.
In the terminal you should see:
$ docker-compose-up
Wait for Jenkins to boot up. Open a browser and go to:
localhost:8080
If you don't see any jobs refresh the browser and check the docker-compose
logs.
To stop press CTRL+C
in terminal.
To remove all containers with all of its data run:
docker-compoes down
If you wish to update jenkins for some reason then:
- Update jenkins version in
Dockerfile
- Rebuild docker image and start a new jenkins container.
- Manually update jenkins plugins using the
Install or update Jenkins plugins
guide.
If you just want to test new plugins without committing them to git then stop at step 2.
-
Start jenkins container.
-
Manually install or update plugins through the UI.
-
Restart jenkins to verify it's still working.
-
Copy output of the following command to
plugins.txt
file (located in this repository):curl -s http://localhost:8080/pluginManager/api/json?depth=1 \ | jq -r '.plugins[] | "\(.shortName):\(.version)"' \ | sort
-
Rebuild docker image and start a new containers to verify new plugins have been installed:
docker-compose build docker-compose down docker-compose up
- jenkins - Customized with pre-installed plugins and disabled authentication.