SlideShare a Scribd company logo
Hudson
                          Your Robotic Butler

                                by @stevenmerrill

                           steven@treehouseagency.com

                              http://dgo.to/@smerrill




Saturday, July 24, 2010
Hudson

                 • Java-based continuous integration engine

                 • Used to automate any regular job

                 • Send notifications through a variety of channels




Saturday, July 24, 2010
Why Use It?
                 • Automate tasks that developers should run

                 • Get detailed console logs for jobs without
                   inserting into your Drupal database

                 • Run jobs on any number of servers and chain
                   them together contingent on the success

                 • Notify users in a variety of media


Saturday, July 24, 2010
Setting Up Hudson
                                 Cheerio!



Saturday, July 24, 2010
Getting Hudson

                 • Hudson is packaged as a .war file

                 • Run it on a standard servlet container

                 • Hudson labs also maintains a .deb file and an
                   apt repository




Saturday, July 24, 2010
Setup Tips
                 • Run the Hudson server as a user with umask
                   002 and with the same primary group as your
                   web server

                 • This will make sure that permissions are correct
                   for files when DrupalWebTestCase::drupalGet()
                   or the like invoke your web server

                 • http://drupal.org/node/838852


Saturday, July 24, 2010
Setup, cont’d
                 • You can also use Apache (or nginx, etc) to
                   proxy Hudson so that you can run it without
                   having to use :8080 in the URL

                 • Use Apache’s mod_proxy and the instructions
                   at http://wiki.hudson-ci.org/display/HUDSON/
                   Running+Hudson+behind+Apache



Saturday, July 24, 2010
Configuring on Ubuntu

                 • The simplest way to get up and running with
                   Hudson is with Ubuntu and their apt repository

                 • http://pkg.hudson-labs.org/debian/




Saturday, July 24, 2010
Configuring on Ubuntu, cont’d
                 • wget -q -O - http://pkg.hudson-labs.org/debian/
                   hudson-labs.org.key | sudo apt-key add -

                 • sudo sh -c "echo 'deb http://pkg.hudson-labs.org/
                   debian binary/' >> /etc/apt/sources.list"

                 • sudo apt-get update

                 • sudo apt-get install hudson

                 • sudo make me a sandwich (this will take awhile)


Saturday, July 24, 2010
Configuring on Ubuntu, cont’d
                 • sudo usermod -G www-data hudson

                 • sudo nano -w /etc/init.d/hudson

                      • Add --umask=002 to DAEMON_ARGS

                 • sudo service hudson stop

                 • sudo service hudson start


Saturday, July 24, 2010
You now have a robotic butler at your command.



Saturday, July 24, 2010
Terminology
                 • Every task you wish to automate using Hudson will is
                   called a job

                 • The directory on the file system where a job’s source
                   files are checked out it the workspace

                 • You create numerous build steps to execute
                   whenever the job is run, which is called a build

                 • You can take any number of files produced by the
                   build and save them as artifacts


Saturday, July 24, 2010
Terminology, cont’d

                 • Each build has two status axes

                 • Failure or success

                 • Stable or unstable




Saturday, July 24, 2010
This is Drizzle’s build farm at http://hudson.drizzle.org/.



Saturday, July 24, 2010
Working with Jobs
                           Credit: http://www.flickr.com/photos/techshownetwork/2943427637/



Saturday, July 24, 2010
Job Configuration
                 • Each job has a unique name

                 • Name your jobs like Drupal variables -
                   lowercase and underscores

                 • On the Ubuntu install, a folder will be created in
                   /var/lib/hudson/jobs/[job name] .




Saturday, July 24, 2010
Source Control Integration
                 • Hudson can check source control for you and build
                   your project when there are changes

                 • Hudson will do a checkout and then grab any available
                   changes and start a build once it has grabbed them

                 • Other advantages include being able to have the
                   notification plugins send out a list of changes and the
                   ability to create Hudson users for each person who
                   commits to your repository



Saturday, July 24, 2010
Source Control, cont’d
                 • For the job where you’ll be running your unit
                   tests from, make sure you do not choose the
                   option to do a clean checkout every time.

                 • There are source control integration plugins for
                   nearly every VCS out there, including the open-
                   source standards cvs, svn, hg, bzr and git, and
                   proprietary ones such as Perforce, ClearCase
                   and even Team Foundation Server.


Saturday, July 24, 2010
Notifications
                 • Hudson has built-in notifications via email

                 • Via user integration, it can also email users who have
                   broken or fixed the build

                 • Many plugins exist for other notification media, such
                   as multi-protocol IM and IRC, suitable for running in
                   a team IRC room

                 • If you enter committers IRC nicks / IM handles, the
                   bot will praise or chastise them


Saturday, July 24, 2010
Slave Builds
                 • Hudson can install a Java-based slave via SSH
                   on any *nix machine

                 • The slave will run builds on the local machine
                   and report build status back to Hudson

                 • Jobs can be tied to any open slave (better for
                   jobs like running cron) or to a specific machine
                   (often used for deployments)


Saturday, July 24, 2010
Build Steps
                          Credit: http://www.flickr.com/photos/mbgrigby/3427948763



Saturday, July 24, 2010
Build Steps
                 • The meat of any job is the build steps that it
                   goes through

                 • When used with *nix machines, these build
                   steps are shell scripts

                 • Hudson sets a number of environmental
                   variables when these jobs are run



Saturday, July 24, 2010
Build Steps, cont’d
                 • $WORKSPACE - the directory with the VCS code

                 • $BUILD_URL - the URL to this specific build

                 • $BUILD_NUMBER - the integer build number

                 • In addition, you can create parameterized builds
                   where a default value is set, but users running
                   builds in the Hudson interface can specify a
                   different value on a per-build basis


Saturday, July 24, 2010
Build Steps, cont’d
                 • When you look in the console for a build that
                   runs, you’ll see that it runs sh -xe and then the
                   scripts that you have put into the build steps

                 • This option will make it so that if any step in the
                   process returns a non-zero exit code, the build
                   will fail



Saturday, July 24, 2010
Testing
                 • The most obvious use for testing is to run
                   Drupal SimpleTests on every checkin

                 • To do this, set up a job connected to your
                   source control and that checks out your site

                 • Install the site on the machine and make sure
                   that the SimpleTest module is enabled



Saturday, July 24, 2010
Testing, cont’d
                 • With the SimpleTest module enabled, you can
                   use the scripts/run-tests.sh script to run
                   SimpleTests from the command line

                 • These tests will be run as the Hudson user
                   when run through Hudson, so that’s where the
                   umask 002 we set up earlier is important



Saturday, July 24, 2010
Testing, cont’d
                 • The SimpleTest module in Pressflow 6 contains
                   a patch to allow the SimpleTest run-tests.sh
                   script to output test results in the JUnit XML
                   format using the --xml switch

                 • Hudson will show your test successes and
                   failure and to make a build unstable if tests fail

                 • http://drupal.org/node/602332


Saturday, July 24, 2010
Linking Jobs
                          Credit: http://www.flickr.com/photos/lopolis/2623060590/



Saturday, July 24, 2010
Other Scheduling Options
                 • In addition to having a build run whenever there
                   are new changes on a branch in source control,
                   you can schedule builds:

                      • Using a cron-like syntax

                      • To run when another completes successfully

                      • By hand or with a GET to /job/[job name]/build


Saturday, July 24, 2010
Other Scheduling, cont’d

                 • When you make a chain of builds, one failure in
                   a build in the chain will stop the whole thing

                 • You can also select to make a single unstable
                   build stop the chain




Saturday, July 24, 2010
Deployment
                          Credit: http://www.flickr.com/photos/mateus27_24-25/2760653277/



Saturday, July 24, 2010
Deployment
                 • Hudson is a great tool for automating
                   deployments

                 • A common workflow when working with DVCS
                   systems is to have an integration branch or
                   repository that changes get pushed to

                 • When new changes appear in the integration
                   repo, Hudson can check it and run tests


Saturday, July 24, 2010
Deployment, cont’d
                 • Using drush (and optionally its master/slave
                   support) it is quite easy to automate updating
                   other environments

                 • Provided that all important schema updates are
                   in code, drush can run all these automatically in
                   a deploy task



Saturday, July 24, 2010
Deployment, cont’d
                 • The following script can be used as a deploy
                   script on a local or remote machine:

                 • drush -y updb

                 • drush -y features-update-all

                 • drush -y cc all



Saturday, July 24, 2010
Other Cool Tricks
                           Credit: http://www.flickr.com/photos/nowhere77/2571139625/



Saturday, July 24, 2010
Run cron

                 • David Strauss of Four Kitchens similarly
                   elucidates on why Drush and Hudson rock and
                   how you can use them together

                 • http://fourkitchens.com/blog/2010/05/09/drop-
                   cron-use-hudson-instead




Saturday, July 24, 2010
View Status in NetBeans


                 • NetBeans includes a Hudson plugin in core.




Saturday, July 24, 2010
Track Back-End Performance
                 • Make a build that does some GET requests
                   against a production site

                 • Set “XDEBUG_PROFILE” in $_GET, $_POST or
                   $_COOKIE to get a cachegrind file

                 • Run the cachegrind file through xdebugtoolkit to
                   get a nice PDF to show where your execution
                   time goes and track it over time.


Saturday, July 24, 2010
Yellow items are called a lot, red items take a lot of time per call.
                                              Magenta items are both.


Saturday, July 24, 2010
Track Front-End Performance
                 • Install ShowSlow from showslow.com

                 • Use xtightvnc to make a virtual display that
                   ShowSlow’s integration scripts can direct
                   Firefox at on a set schedule

                 • Compare your Google Page Speed and YSlow!
                   scores over time

                          Sorry, a magician doesn’t reveal his secrets, and I haven’t had enough time
                                  to write up these instructions yet. But it works - Trust Me™.


Saturday, July 24, 2010
Thanks
                 • The whole @hudsonci team for their work in
                   creating this amazing tool.

                 • Steven Jones for his work on JUnit XML output
                   for SimpleTests.

                 • The Pressflow team for including the patch in
                   Pressflow 6.

                                   Community plumbing, baby.



Saturday, July 24, 2010
Questions?




Saturday, July 24, 2010

More Related Content

PPTX
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
PPTX
Hudson
 
PDF
Improving Engineering Processes using Hudson - Spark IT 2010
PPTX
Jenkins Pipeline 101 and TCI - presentation and workshop
PPTX
Jenkins presentation
PDF
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
PPTX
Supermondays: Jenkins CI lightning talk
PPTX
Jenkins CI presentation
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Hudson
 
Improving Engineering Processes using Hudson - Spark IT 2010
Jenkins Pipeline 101 and TCI - presentation and workshop
Jenkins presentation
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
Supermondays: Jenkins CI lightning talk
Jenkins CI presentation

What's hot (20)

PDF
Hacking Jenkins
PPTX
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
PDF
Hudson at FISL 2009
PPTX
Jenkins, pipeline and docker
PPTX
Introduction to Containers & Diving a little deeper into the benefits of Con...
PPTX
7 Habits of Highly Effective Jenkins Users
PDF
Let’s start Continuous Integration with jenkins
PDF
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
ODP
An Introduction To Jenkins
PPTX
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
PPT
CI and CD with Jenkins
PDF
7 Ways to Optimize Hudson in Production
PDF
(Declarative) Jenkins Pipelines
PPTX
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
PDF
OSDC 2017 - Julien Pivotto - Automating Jenkins
PPTX
Pipeline as code using Jenkins -Ministry of Testing
PPTX
Jenkins for java world
PDF
DevOps: Cooking Drupal Deployment
PPTX
Hacking Jenkins
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
Hudson at FISL 2009
Jenkins, pipeline and docker
Introduction to Containers & Diving a little deeper into the benefits of Con...
7 Habits of Highly Effective Jenkins Users
Let’s start Continuous Integration with jenkins
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
An Introduction To Jenkins
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
CI and CD with Jenkins
7 Ways to Optimize Hudson in Production
(Declarative) Jenkins Pipelines
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
OSDC 2017 - Julien Pivotto - Automating Jenkins
Pipeline as code using Jenkins -Ministry of Testing
Jenkins for java world
DevOps: Cooking Drupal Deployment
Ad

Viewers also liked (14)

PPTX
Behavioral Segmentation Analytics
PDF
15RV&TT_Ford_SuperDtyPU_Sep30
DOCX
Daniel inglish
PDF
CSR Västsveriges ansvarsinitiativ socialt ansvar (reviderad 2016)
ODT
Plantilla creación proyecto_etwinning
KEY
Color Me Flexible
PDF
CSR Västsveriges ansvarsinitiativ miljöansvar (reviderad 2016)
PDF
November/December Leverage
PPTX
Life at VCAD on Instagram by creative_obscurities in Vancouver, British Columbia
PDF
The Hamburg Rutting Test – Alternative Data Analysis Methods and HMA Screenin...
PDF
عيوب الرصفات الاسفلتية
PPTX
Importance of highway maintenance
PDF
Securing your Containers (Meetup at Docker HQ 4/7)
PDF
Pavement Maintenance Practices in
Behavioral Segmentation Analytics
15RV&TT_Ford_SuperDtyPU_Sep30
Daniel inglish
CSR Västsveriges ansvarsinitiativ socialt ansvar (reviderad 2016)
Plantilla creación proyecto_etwinning
Color Me Flexible
CSR Västsveriges ansvarsinitiativ miljöansvar (reviderad 2016)
November/December Leverage
Life at VCAD on Instagram by creative_obscurities in Vancouver, British Columbia
The Hamburg Rutting Test – Alternative Data Analysis Methods and HMA Screenin...
عيوب الرصفات الاسفلتية
Importance of highway maintenance
Securing your Containers (Meetup at Docker HQ 4/7)
Pavement Maintenance Practices in
Ad

Similar to Hudson: Your robotic butler (20)

PPT
Undine: Turnkey Drupal Development Environments
PPTX
Instant hadoop of your own
PPTX
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
PPTX
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
PPTX
Continuous integration of_puppet_code
PDF
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
PPTX
Welcome to Azure DevOps
PPTX
Fits docker into devops
PPTX
habitat at docker bud
PPTX
How to Upgrade Your Hadoop Stack in 1 Step -- with Zero Downtime
KEY
Depolying Drupal with Git, Drush Make and Capistrano
PPTX
Habitat at LinuxLab IT
PPTX
Visual Studio Release Management - New weltanschauung or natural evolution? @...
PPTX
Composer JSON kills make files
PDF
Docker at Djangocon 2013 | Talk by Ken Cochrane
PDF
Django and Docker
PPTX
Structor - Automated Building of Virtual Hadoop Clusters
PPTX
Secure Hadoop clusters on Windows platform
PPT
Drush and drupal. администрирование волчек михаил
PDF
DockerCon SF 2015: Maintaining the official node.js docker image
Undine: Turnkey Drupal Development Environments
Instant hadoop of your own
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
Continuous integration of_puppet_code
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Welcome to Azure DevOps
Fits docker into devops
habitat at docker bud
How to Upgrade Your Hadoop Stack in 1 Step -- with Zero Downtime
Depolying Drupal with Git, Drush Make and Capistrano
Habitat at LinuxLab IT
Visual Studio Release Management - New weltanschauung or natural evolution? @...
Composer JSON kills make files
Docker at Djangocon 2013 | Talk by Ken Cochrane
Django and Docker
Structor - Automated Building of Virtual Hadoop Clusters
Secure Hadoop clusters on Windows platform
Drush and drupal. администрирование волчек михаил
DockerCon SF 2015: Maintaining the official node.js docker image

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Big Data Technologies - Introduction.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Monthly Chronicles - July 2025
Big Data Technologies - Introduction.pptx
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks

Hudson: Your robotic butler

  • 1. Hudson Your Robotic Butler by @stevenmerrill steven@treehouseagency.com http://dgo.to/@smerrill Saturday, July 24, 2010
  • 2. Hudson • Java-based continuous integration engine • Used to automate any regular job • Send notifications through a variety of channels Saturday, July 24, 2010
  • 3. Why Use It? • Automate tasks that developers should run • Get detailed console logs for jobs without inserting into your Drupal database • Run jobs on any number of servers and chain them together contingent on the success • Notify users in a variety of media Saturday, July 24, 2010
  • 4. Setting Up Hudson Cheerio! Saturday, July 24, 2010
  • 5. Getting Hudson • Hudson is packaged as a .war file • Run it on a standard servlet container • Hudson labs also maintains a .deb file and an apt repository Saturday, July 24, 2010
  • 6. Setup Tips • Run the Hudson server as a user with umask 002 and with the same primary group as your web server • This will make sure that permissions are correct for files when DrupalWebTestCase::drupalGet() or the like invoke your web server • http://drupal.org/node/838852 Saturday, July 24, 2010
  • 7. Setup, cont’d • You can also use Apache (or nginx, etc) to proxy Hudson so that you can run it without having to use :8080 in the URL • Use Apache’s mod_proxy and the instructions at http://wiki.hudson-ci.org/display/HUDSON/ Running+Hudson+behind+Apache Saturday, July 24, 2010
  • 8. Configuring on Ubuntu • The simplest way to get up and running with Hudson is with Ubuntu and their apt repository • http://pkg.hudson-labs.org/debian/ Saturday, July 24, 2010
  • 9. Configuring on Ubuntu, cont’d • wget -q -O - http://pkg.hudson-labs.org/debian/ hudson-labs.org.key | sudo apt-key add - • sudo sh -c "echo 'deb http://pkg.hudson-labs.org/ debian binary/' >> /etc/apt/sources.list" • sudo apt-get update • sudo apt-get install hudson • sudo make me a sandwich (this will take awhile) Saturday, July 24, 2010
  • 10. Configuring on Ubuntu, cont’d • sudo usermod -G www-data hudson • sudo nano -w /etc/init.d/hudson • Add --umask=002 to DAEMON_ARGS • sudo service hudson stop • sudo service hudson start Saturday, July 24, 2010
  • 11. You now have a robotic butler at your command. Saturday, July 24, 2010
  • 12. Terminology • Every task you wish to automate using Hudson will is called a job • The directory on the file system where a job’s source files are checked out it the workspace • You create numerous build steps to execute whenever the job is run, which is called a build • You can take any number of files produced by the build and save them as artifacts Saturday, July 24, 2010
  • 13. Terminology, cont’d • Each build has two status axes • Failure or success • Stable or unstable Saturday, July 24, 2010
  • 14. This is Drizzle’s build farm at http://hudson.drizzle.org/. Saturday, July 24, 2010
  • 15. Working with Jobs Credit: http://www.flickr.com/photos/techshownetwork/2943427637/ Saturday, July 24, 2010
  • 16. Job Configuration • Each job has a unique name • Name your jobs like Drupal variables - lowercase and underscores • On the Ubuntu install, a folder will be created in /var/lib/hudson/jobs/[job name] . Saturday, July 24, 2010
  • 17. Source Control Integration • Hudson can check source control for you and build your project when there are changes • Hudson will do a checkout and then grab any available changes and start a build once it has grabbed them • Other advantages include being able to have the notification plugins send out a list of changes and the ability to create Hudson users for each person who commits to your repository Saturday, July 24, 2010
  • 18. Source Control, cont’d • For the job where you’ll be running your unit tests from, make sure you do not choose the option to do a clean checkout every time. • There are source control integration plugins for nearly every VCS out there, including the open- source standards cvs, svn, hg, bzr and git, and proprietary ones such as Perforce, ClearCase and even Team Foundation Server. Saturday, July 24, 2010
  • 19. Notifications • Hudson has built-in notifications via email • Via user integration, it can also email users who have broken or fixed the build • Many plugins exist for other notification media, such as multi-protocol IM and IRC, suitable for running in a team IRC room • If you enter committers IRC nicks / IM handles, the bot will praise or chastise them Saturday, July 24, 2010
  • 20. Slave Builds • Hudson can install a Java-based slave via SSH on any *nix machine • The slave will run builds on the local machine and report build status back to Hudson • Jobs can be tied to any open slave (better for jobs like running cron) or to a specific machine (often used for deployments) Saturday, July 24, 2010
  • 21. Build Steps Credit: http://www.flickr.com/photos/mbgrigby/3427948763 Saturday, July 24, 2010
  • 22. Build Steps • The meat of any job is the build steps that it goes through • When used with *nix machines, these build steps are shell scripts • Hudson sets a number of environmental variables when these jobs are run Saturday, July 24, 2010
  • 23. Build Steps, cont’d • $WORKSPACE - the directory with the VCS code • $BUILD_URL - the URL to this specific build • $BUILD_NUMBER - the integer build number • In addition, you can create parameterized builds where a default value is set, but users running builds in the Hudson interface can specify a different value on a per-build basis Saturday, July 24, 2010
  • 24. Build Steps, cont’d • When you look in the console for a build that runs, you’ll see that it runs sh -xe and then the scripts that you have put into the build steps • This option will make it so that if any step in the process returns a non-zero exit code, the build will fail Saturday, July 24, 2010
  • 25. Testing • The most obvious use for testing is to run Drupal SimpleTests on every checkin • To do this, set up a job connected to your source control and that checks out your site • Install the site on the machine and make sure that the SimpleTest module is enabled Saturday, July 24, 2010
  • 26. Testing, cont’d • With the SimpleTest module enabled, you can use the scripts/run-tests.sh script to run SimpleTests from the command line • These tests will be run as the Hudson user when run through Hudson, so that’s where the umask 002 we set up earlier is important Saturday, July 24, 2010
  • 27. Testing, cont’d • The SimpleTest module in Pressflow 6 contains a patch to allow the SimpleTest run-tests.sh script to output test results in the JUnit XML format using the --xml switch • Hudson will show your test successes and failure and to make a build unstable if tests fail • http://drupal.org/node/602332 Saturday, July 24, 2010
  • 28. Linking Jobs Credit: http://www.flickr.com/photos/lopolis/2623060590/ Saturday, July 24, 2010
  • 29. Other Scheduling Options • In addition to having a build run whenever there are new changes on a branch in source control, you can schedule builds: • Using a cron-like syntax • To run when another completes successfully • By hand or with a GET to /job/[job name]/build Saturday, July 24, 2010
  • 30. Other Scheduling, cont’d • When you make a chain of builds, one failure in a build in the chain will stop the whole thing • You can also select to make a single unstable build stop the chain Saturday, July 24, 2010
  • 31. Deployment Credit: http://www.flickr.com/photos/mateus27_24-25/2760653277/ Saturday, July 24, 2010
  • 32. Deployment • Hudson is a great tool for automating deployments • A common workflow when working with DVCS systems is to have an integration branch or repository that changes get pushed to • When new changes appear in the integration repo, Hudson can check it and run tests Saturday, July 24, 2010
  • 33. Deployment, cont’d • Using drush (and optionally its master/slave support) it is quite easy to automate updating other environments • Provided that all important schema updates are in code, drush can run all these automatically in a deploy task Saturday, July 24, 2010
  • 34. Deployment, cont’d • The following script can be used as a deploy script on a local or remote machine: • drush -y updb • drush -y features-update-all • drush -y cc all Saturday, July 24, 2010
  • 35. Other Cool Tricks Credit: http://www.flickr.com/photos/nowhere77/2571139625/ Saturday, July 24, 2010
  • 36. Run cron • David Strauss of Four Kitchens similarly elucidates on why Drush and Hudson rock and how you can use them together • http://fourkitchens.com/blog/2010/05/09/drop- cron-use-hudson-instead Saturday, July 24, 2010
  • 37. View Status in NetBeans • NetBeans includes a Hudson plugin in core. Saturday, July 24, 2010
  • 38. Track Back-End Performance • Make a build that does some GET requests against a production site • Set “XDEBUG_PROFILE” in $_GET, $_POST or $_COOKIE to get a cachegrind file • Run the cachegrind file through xdebugtoolkit to get a nice PDF to show where your execution time goes and track it over time. Saturday, July 24, 2010
  • 39. Yellow items are called a lot, red items take a lot of time per call. Magenta items are both. Saturday, July 24, 2010
  • 40. Track Front-End Performance • Install ShowSlow from showslow.com • Use xtightvnc to make a virtual display that ShowSlow’s integration scripts can direct Firefox at on a set schedule • Compare your Google Page Speed and YSlow! scores over time Sorry, a magician doesn’t reveal his secrets, and I haven’t had enough time to write up these instructions yet. But it works - Trust Me™. Saturday, July 24, 2010
  • 41. Thanks • The whole @hudsonci team for their work in creating this amazing tool. • Steven Jones for his work on JUnit XML output for SimpleTests. • The Pressflow team for including the patch in Pressflow 6. Community plumbing, baby. Saturday, July 24, 2010