You learned a lot about Jenkins configuration throughout this chapter. To consolidate your knowledge, we recommend two exercises for preparing the Jenkins images and testing the Jenkins environment:
- Create Jenkins master and slave Docker images, and use them to run a Jenkins infrastructure capable of building Ruby projects:
- Create the Jenkins master Dockerfile, which automatically installs the Docker plugin
- Build the master image and run the Jenkins instance
- Create the slave Dockerfile (suitable for the dynamic slave provisioning), which installs the Ruby interpreter
- Build the slave image
- Change the configuration in the Jenkins instance to use the slave image
- Create a pipeline that runs a Ruby script printing
Hello World from Ruby
:- Create a new pipeline
- Use the following shell command to create the
hello.rb
script on the fly:
sh "echo \"puts 'Hello World from Ruby'\" > hello.rb"
- Add the command to run
hello.rb
, using the Ruby interpreter - Run the build and observe the console's output
- Add the command to run
...