Question

I hear the buzz words, "continuous integration", "drush" and "jenkins" often. Thus, sparking my interest.

How are drush and jenkins used together for continuous integration?

Also, why would you want to use drush and jenkins together?

Was it helpful?

Solution

For my projects, I use a build script made of Drush commands in a Jenkins job. I use my Phing Drush Task project to run Drush from a Phing build script. This allow me to leverage the existing Phing tasks (eg. files copy, phplint, etc.). With the help of Drush, this build script

  • Downloads all non-custom code (ie. Drupal core and contribs module and themes) with Drush Make to ./dist
  • Expands placeholders in a versioned settings.php (ie. replace ${db_host} with the actual DB hostname) while copying it to the freshly downloaded ./dist/sites/default folder.
  • Copy custom modules and themes to ./dist/sites/all/modules/custom and ./dist/sites/all/themes/custom
  • Run phplint for all files from my custom modules and themes.
  • Copy everything under ./dist to a pre-configured webroot.
  • Run drush site-install testing and drush pm-enable simpletest to install a fresh site using the build code base and able to run SimpleTest.
  • Run drush test-run to run my custom module test suites.
  • Run drush coder-review.

Here is a commented build.xml template for Drush usage in Jenkins.

OTHER TIPS

You can use Phing in Jenkins, so you can use Drush through http://drupal.org/project/phingdrushtask (Pierre Buyle on SE.COM)

Custom example:

 <drush command='cc' root="${project.drupal.core.dir}" uri="${env.host.name}" assume="yes">
  <param>all</param>
</drush>
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top