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.
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.
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.
jenkins-drupal-templateproject from Git:
cd $JENKINS_HOME/jobs git clone git://github.com/reload/jenkins-drupal-template.git drupal-template chown -R jenkins:nogroup drupal-template/
java -jar jenkins-cli.jar -s http://localhost:8080 reload-configuration
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.
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.
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.
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.
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.
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.