This post is the fifth in a series of posts describing how I’ve used Docker to build a lab setup on my laptop to try out Zuul and check out its various features. Previously I’ve described how to install Jenkins, Gerrit and add the zuul-server and zuul-merger components.
Zuul communicates with Jenkins by means of the Gearman Plugin.
Setting up the Jenkins Gearman Plugin
We’ve already installed the Geraman Plugin when we’ve created the Jenkins container.
The plugin itself does not require a lot of configuration (In that regard it is far simpler the the Gerrit Trigger Plugin), all we need to do is go to “Jenkins” -> “Manage Jenkins” -> “Configure System”, scroll down to the “Gearman Plugin Config” section and fill in the Gearman server information. In the case of the containers we’ve been setting up that would be:
- Gearman Server Host: 172.17.0.4 (The IP of the zuul-server container)
- Gearman Server Port: 4730 (This the default Gearman port that we’ve exposed from the container)
After entering the details above we can click the “Test Connection” button. Once we are satisfied with the results, we can check the “Enable Gearman” checkbox.
We can also verify Jenkins connected successfully by querying Gearman itself:
echo workers | ncat 172.17.0.4 4730
We should see a few lines like the following that indicate that each Jenkins executer got registered as a Gearman worker and each job got registered as a function.
11 172.17.0.2 d692337beb99_exec-3 : build:zuul-check-patch build:zuul-check-merged build:OpenShift Sample
Note: The line you see in practice would probably be a little different, depending on the jobs you’ve setup in Jenkins. I will describe the jobs I’ve created in a later post.
Adding the Zuul UI
DocumentRoot "/opt/zuul/etc/status/public_html" RewriteEngine on RewriteRule ^/status.json$ http://172.17.0.4:8001/status.json [P] RewriteRule ^/status/(.*) http://172.17.0.4:8001/status/$1 [P] <Directory /opt/zuul/etc/status/public_html> Require all granted Allow from all </Directory>
Unfortunately Zuul UI is not shipped as part of the Zuul PyPi package, so we need to clone its source code into the container. Having Apache serve it is then just a matter of making the right directory shared by Apache as can be seem on line #1 above.
To make the UI communicate with Zuul itself, I make the Zuul status JSON page available via the same HTTP server with some mod_rewrite rules, as can be seen on lines #3 through #5.
The files required to build this container can be downloaded from Git Hub. The command to build it would then be:
sudo docker build -t zuul-ui-server:latest zuul_ui_server/
The command to run the built container is rather simple in this case as well (A “run.sh” script as written for other containers, could be found on Git Hub as well):
sudo docker run -d --name zuul-ui-server zuul_ui_server:latest
After launching the container, we could have a look at the UI page by navigating with a browser to its IP address. On may machine that would be at http://172.17.0.7/.
If you’ve followed my posts about this subject to the latter so far, your UI will look different then the image above, because we have not gotten around to creating Jenkins jobs and Zuul pipelines yet. I will describe how to do this in the next (and last) instalment of this series.