Jenkins job template for Drupal projects

Most web applications are changed and adapted quite frequently and quickly. Their environment, for example the size and the behaviour of the user base, are constantly changing. What was sufficient yesterday can be insufficient today. Especially in a web environment it is important to monitor and continuously improve the internal quality not only when developing, but also when maintaining the software.

Jenkins is the leading open-source continuous integration server. Thanks to its thriving plugin ecosystem, it supports building and testing virtually any project.

Sebastian Bergmann and contributors, Template for Jenkins Jobs for PHP Projects

The goals of the Jenkins job template for PHP projects also holds true for Drupal projects. However Drupal has it's own idiosyncrasies so tools and metrics differ.

This project aims to provide a standard Jenkins job template for Drupal projects.

Along with the Phing Drupal Template and the Drupal Jenkins demo it is a part of an effort to create better continuous integration tools for Drupal projects to improve quality.

Required Jenkins Plugins

You need to install the following plugins for Jenkins:

You can install these plugins using the web frontend at


or using the Jenkins CLI:

wget http://localhost:8080/jnlpJars/jenkins-cli.jar
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin analysis-core
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin analysis-collector
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin checkstyle
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin dry
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin phing
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin plot
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin pmd
java -jar jenkins-cli.jar -s http://localhost:8080 safe-restart

In the above, replace localhost:8080 with the hostname and port of your Jenkins installation.

Build Automation

The configuration of the job template follows the artifacts produced by a Phing build.xml file based on the Phing Drupal Template.

The template assumes that the build template has been added as a submodule in \build as described in the Phing Drupal template documentation.

Using the Job Template

  1. Check out the jenkins-drupal-template project from Git:
    cd $JENKINS_HOME/jobs
    git clone git:// drupal-template
    chown -R jenkins:nogroup drupal-template/
  2. Reload Jenkins' configuration, for instance using the Jenkins CLI:
    java -jar jenkins-cli.jar -s http://localhost:8080 reload-configuration
  3. Click on New Job.
  4. Enter a Job name.
  5. Select Copy existing job and enter drupal-template into the Copy from field.
  6. Click OK.
  7. Disable the Disable Build option.
  8. Fill in your Source Code Management information.
  9. Configure a Build Trigger, for instance Poll SCM.
  10. Click Save.


The drupal-jenkins-demo repository contains a Drupal project with the Phing Drupal Template and the Token module as example of custom code is continuously integrated for demonstration purposes.

Differences from PHP Template

The job template has a number of differences from the original Template for Jenkins Jobs for PHP Projects. Some of these are due to Drupal tools and practices and others personal preference.

Build file in separate project

Due to the extensive work required to setup an automated build for Drupal projects the build file has been split into a separate project. This also makes the build file useful with other continuous integration systems.

JDepend plugin removed

The metrics calculated by PHP_Depend and displayed by the JDepend plugin are mostly related for object oriented programming. Most Drupal modules written using functional programming and thus the metrics are at best of little value, at worst misleading.

xUnit plugin removed

Drupal tests are run through the SimpleTest framework. SimpleTest results can be written in JUnit XML format using Drupal scripts or Drush and Jenkins understands this format natively so there is no need for the plugin.

Static Code Analysis plugins replaces Violations

The Static Code Analysis plugins suite and Violations plugin both support parsing and rendering static code analysis results. The Static Code Analysis plugins are used as they are have more features and are frequently updated.


Issues are tracked on GitHub. Comments and pull requests welcome.