Jenkins and Drupal

Juampy NR - @juampynr

DrupalCamp Costa Rica 2015

Juampy NR - @juampynr

Senior Developer

about.me/juampynr

What is Jenkins?

“Jenkins is an award-winning application that monitors executions of repeated jobs, such as building a software project or jobs run by cron.”
Jenkins Wiki

Overview

Setting up Jenkins

  1. Installation.
  2. Adding credentials.
  3. Adding a node.

1. Installation

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins

2. Adding credentials

3. Adding a node

Job examples

  • Running cron.
  • Introducing continuous integration.
  • Downloading data from production to development
  • Deploying a release.

Running cron

Running cron - setting the node

Running cron - frequency

Running cron - do it!

Running cron - notifications

Running cron - overview

Introducing Continuous Integration

Continuous integration (CI) is the practice, in software engineering, of merging all developer working copies with a shared mainline several times a day.
Wikipedia

CI - Watching master branch

CI - Triggering on git push

CI - Execute shell script

Downloading data from Production to Development (Downsync)

Downsync - Testing access from source to target

              
juampy@juampy-box:~ $ ssh dev.example.com
juampy@dev:~$ sudo su jenkins
jenkins@dev:/home/juampy$ cd /var/www/edit.example/docroot
jenkins@dev:/var/www/edit.example.com/docroot$ drush @lullabot.prod status
 Drupal version                  :  7.38                                                                                                              
 Site URI                        :  http://edit.lullabot.com                                                                                          
 Database driver                 :  mysql                                                                                                             
 Drupal bootstrap                :  Successful                                                                                                        
 Drupal user                     :  Anonymous                                                                                                         
 Site path                       :  sites/default                                                                                                     
 File directory path             :  sites/default/files                                                                                               
 Temporary file directory path   :  /tmp               
jenkins@dev:/var/www/edit.example.com/docroot$ drush @lullabot.prod status
jenkins@dev:/var/www/edit.example.com/docroot$ exit
exit
juampy@dev:~$ exit
logout
Connection to dev.example.com closed.
              
            

Downsync - Avoiding collisions between jobs

CI - Execute shell script

Deploying releases

Deployments - Adding parameters

Deployments - Shell script

Alternative ways to trigger jobs

  • Manual trigger.
  • Jenkins IRC bot.
  • When another job finishes.
  • When a certain comment is made in GitHub.

Resources

Thanks! Questions?

@juampynr

about.me/juampynr

Lullabot is looking for projects!