Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Hudson is a very simple Java web application deployed in a single WAR file. A WAR file is simply a Java Archive (like a zip file) with web related source files and configuration inside. It like packaging up a PHP application in a zip file with classes, scripts, css, and html. Hudson run a very small application server called Winstone as a service. You never have to worry about maintaining it.

Of course the above commands are optional but I have provided them as for those not familiar with Ubuntu administration.

http://10.211.55.7:8080/

http://10.211.55.7:8080/

http://10.211.55.7:8080/ Run a single set of test cases, not the entire suite.

https://gist.github.com/781608

http://10.211.55.7:8080/ Run a single set of test cases, not the entire suite.

Now, run build, then browse to http://api.example.com/

Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH

1.
&quot;THE BASIC RULE OF THUMB IS THAT YOU SHOULD BE ABLE TO WALK UP TO THE PROJECT WITH A VIRGIN MACHINE, DO A CHECKOUT, AND BE ABLE TO FULLY BUILD THE SYSTEM.” TAME YOUR BUILD AND DEPLOY PROCESS A LOOK AT HUDSON, PHPUNIT, AND SSH WIL MOORE III @WILMOORE HTTP://GITHUB.COM/WILMOORE

3.
<ul><ul><li>Your take-away should be that you understand the steps involved in getting basic continuous integration going. </li></ul></ul><ul><ul><li>You understand that there is no single recipe for success. Each environment is different and Hudson is a single tool. </li></ul></ul><ul><ul><li>You should understand when to use Hudson and when not to use Hudson. </li></ul></ul><ul><ul><li>You should understand that continuous integration isn’t hard. </li></ul></ul>Goal of this talk

4.
<ul><ul><li>What is it and what are the benefits? </li></ul></ul><ul><ul><li>Automates your semi-automated processes and provides instant feedback about these processes. </li></ul></ul><ul><ul><li>Keeps the team honest as it relates to unit and integration tests. </li></ul></ul><ul><ul><li>Yet another method of documenting your process. </li></ul></ul><ul><ul><li>FYI…the name continuous integration sort of sucks. </li></ul></ul>About Continuous Integration

5.
<ul><ul><li>There is nothing magical about continuous integration. </li></ul></ul><ul><ul><li>It won’t write unit tests for you, and there is no single recipe for setting it all up. </li></ul></ul><ul><ul><li>You could automate your infrastructure without a continuous integration server, but you’d be re-inventing the wheel…and you’d still need to understand your process. </li></ul></ul>You need to understand your process

6.
<ul><ul><li>It’s free </li></ul></ul><ul><ul><li>It has a simple and clean interface </li></ul></ul><ul><ul><li>You can also run it from the command-line </li></ul></ul><ul><ul><li>It’s easy to install (especially with Ubuntu) </li></ul></ul>Why Hudson?

11.
<ul><ul><li>It is inspired by Java’s JUnit framework </li></ul></ul><ul><ul><li>Instead of writing code first, then using echo, print_r, var_export, you write tests first, then write code that will pass the tests. </li></ul></ul><ul><ul><li>@dataProvider allows you to pass arbitrary amounts of test data to a single test so you can see multiple permutations of a single test. </li></ul></ul><ul><ul><li>@group allows you to run specific tests or suites as a group. For instance, you can tag a test (0r group of tests) as corresponding to a bug and run only those tests. </li></ul></ul>About PHPUnit

14.
<ul><ul><li>Local VM, DEV, QA, UAT, STAGE, PROD </li></ul></ul><ul><ul><li>Each should be it’s own hudson job </li></ul></ul><ul><ul><li>You can create a “template” job in hudson </li></ul></ul><ul><ul><li>Build DEV automatically upon your source repository changes </li></ul></ul><ul><ul><li>Build QA on a schedule (nightly, etc.), UAT pushes can be run on-demand, and STAGE/PROD are on-demand just before a new release. </li></ul></ul>What about other environments

17.
<ul><ul><li>It’s like telnet, but communication is encrypted as opposed to plain text. </li></ul></ul><ul><ul><li>You can authenticate with a password or with public/private key pairs. </li></ul></ul><ul><ul><li>You keep the private key tucked secretly away, and you give the public key away to servers you want to authenticate with. For instance, Github has your public key if you want to push to their service. </li></ul></ul><ul><ul><li>You can login to a remote server’s shell interactively or you can pass commands to that shell non-interactively. </li></ul></ul>The least you need to know about SSH

19.
<ul><ul><li>About the hudson file system structure </li></ul></ul><ul><ul><li>Hudson is an actual OS user with a shell and a home directory: /var/lib/hudson </li></ul></ul><ul><ul><li>/var/lib/hudson/jobs/{{job-name}}/workspace This is where your files go after a source check-out </li></ul></ul><ul><ul><li>The workspace ($WORKSPACE) directory is where you run unit tests before pushing via SSH. </li></ul></ul>Where are my files going?

25.
<ul><ul><li>What is a Router class? </li></ul></ul><ul><ul><li>The “Router” class will allow us to match information of $_SERVER[‘REQUEST_URI’] to a controller class. </li></ul></ul><ul><ul><li>The “Router” class will allow us to match information of $_SERVER[‘REQUEST_URI’] to an anonymous function. </li></ul></ul><ul><ul><li>The “Router” class will allow us to match information of $_SERVER[‘REQUEST_URI’] to a global function. </li></ul></ul>Building the routing class