CI tools testing lab: Integrating Jenkins and adding Zuul UI

chain-309566_640In this post I’m going to describe how I connected Jenkins to my experimental Zuul setup. I’m also going to describe how to build a container to expose the Zuul graphical UI over HTTP.

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: (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.

Setting up Gearman plugin in Jenkins

We can also verify Jenkins connected successfully by querying Gearman itself:

echo workers | ncat 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 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

Zuul provides a JSON status page to allow us to monitor its status. It can be rather difficult to understand what is going on by reading it. Fortunately an HTML and JavaScript application is provided with the Zuul source code to provide a graphic display of the Zuul status. All we need to do is build a container to serve it over HTTP. We will use Apache for that, and here is the configuration we will use:

DocumentRoot "/opt/zuul/etc/status/public_html"

RewriteEngine on
RewriteRule ^/status.json$ [P]
RewriteRule ^/status/(.*)$1 [P]

<Directory /opt/zuul/etc/status/public_html>
  Require all granted
  Allow from all

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 “” 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

Zuul UI screenshot

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.


3 thoughts on “CI tools testing lab: Integrating Jenkins and adding Zuul UI

  1. Pingback: CO tools testing lab: Making it do useful work | Ifblog (ponderings 2.0)

  2. Hi,

    this blog was very useful and thanks for the information given,

    i have one query on Gearman Server Host:

    for ex:-

    I am running zuul in (in a container and it will have different ip),
    running Jenkins in

    Now in Jenkins, I configured as Gearman Server Host address under gearman plugin, in order to register the zuul jobs,

    however when i do this my test connection fails,
    Failed: Unable to Connect

    your expertise would solve my issue.

    • Unless you are using something like Kubernetes or Docker compose, there is no DNS service that lets containers recognise each other by name.

      When setting up connections between the containers you need to either use IP addresses or configure the ‘/etc/hosts’ file in each and every one of the containers to make them able to map hostnames to IPs (This can be done with the ‘–add-host’ option to ‘docker run’)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s