Introduction to continuous integration

1,304
-1

Published on

A short introduction to continuous integration and an overview of the Jenkins CI server.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,304
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
36
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction to continuous integration

  1. 1. Introduction to Continuous Integration Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii
  2. 2. Objectives <ul><li>Understand the motivation for continuous integration. </li></ul><ul><li>Become familiar with how to best integrate continuous integration into our practices. </li></ul><ul><li>Become familiar with Hudson/Jenkins, a very popular open source CI technology. </li></ul><ul><ul><li>Hudson is a very popular open source Java-based CI tool developed by Sun Microsystems. </li></ul></ul><ul><ul><li>Jenkins is a fork of Hudson that occurred after Oracle bought Sun </li></ul></ul>
  3. 3. Motivation <ul><li>When many people are working on a project in parallel, there is an “integration problem” </li></ul><ul><ul><li>How to ensure that the work done separately can be “integrated” successfully. </li></ul></ul><ul><li>Levels of the integration problem: </li></ul><ul><ul><li>Merge conflicts : people have modified the same file concurrently. </li></ul></ul><ul><ul><li>Compile conflicts : No merge conflicts, but people have modified files concurrently such that the resulting system does not compile. </li></ul></ul><ul><ul><li>Test conflicts : No merge conflicts, no compile conflicts, but people have modified files concurrently such that the system does not execute successfully. </li></ul></ul>
  4. 4. Integration can be time consuming <ul><li>In some development organizations, groups may work independently on separate “branches” of the system for many months. </li></ul><ul><li>For example, one group might work on the “navigation system” for an aircraft, while another might work on the “flight control system”. </li></ul><ul><li>When these two branches are “integrated” into a single working system, there may be months of work involved in resolving hidden inconsistencies. </li></ul>
  5. 5. Basic Concepts of CI <ul><li>The system must be able to be built and tested automatically. </li></ul><ul><li>The system must be under configuration management. </li></ul><ul><li>Everyone commits their changes frequently (every day or two). </li></ul><ul><li>Upon commit, the system is immediately and automatically “integrated”: </li></ul><ul><ul><li>Compiled, tested, etc. </li></ul></ul><ul><ul><li>Problems are uncovered and developers notified. </li></ul></ul>
  6. 6. Benefits of CI <ul><li>Reduced risk: system always builds, or else you know it quickly. </li></ul><ul><li>Bugs and problems discovered closer to the point in time that they were introduced. </li></ul><ul><li>System is deployable more frequently, enabling more user feedback. </li></ul>
  7. 7. CI in ICS SE <ul><li>Your systems can be built and tested automatically. </li></ul><ul><li>Your systems are under configuration management. </li></ul><ul><li>You hopefully commit your code frequently. </li></ul><ul><li>However, no automated integration! </li></ul><ul><ul><li>Problems only discovered when next person SVN updates and runs verify. </li></ul></ul><ul><li>We can do better! </li></ul>
  8. 8. Jenkins
  9. 9. What Jenkins does <ul><li>Runs as a server. </li></ul><ul><ul><li>I have set one up in my lab for you to use. </li></ul></ul><ul><ul><li>http://dasha.ics.hawaii.edu:9859/ </li></ul></ul><ul><li>You can define “jobs” to do CI. For example: </li></ul><ul><ul><li>Connect to Google Project Hosting every minute. </li></ul></ul><ul><ul><li>Check to see if any changes have been committed. </li></ul></ul><ul><ul><li>If so, </li></ul></ul><ul><ul><ul><li>Check out changes. </li></ul></ul></ul><ul><ul><ul><li>Build the system. </li></ul></ul></ul><ul><ul><ul><li>Run JUnit, PMD, Checkstyle, FindBugs. </li></ul></ul></ul><ul><ul><ul><li>Email failures to your project team. </li></ul></ul></ul>
  10. 10. Jenkins & verify.build.xml <ul><li>Both are useful and complement each other. </li></ul><ul><li>You still want to run verify.build.xml: </li></ul><ul><ul><li>Before committing changes. </li></ul></ul><ul><ul><li>After updating your local workspace. </li></ul></ul><ul><li>Jenkins adds extra safety: </li></ul><ul><ul><li>If you forget to verify, jenkins will remember. </li></ul></ul><ul><ul><li>Sometimes verify works on your machine only. Jenkins helps discover this quickly. </li></ul></ul>
  11. 11. jenkins.build.xml <ul><li>For clarity, let ’s define a new file called jenkins.build.xml that contains the continuous integration target. </li></ul><ul><li>For starters, this can simply invoke verify! </li></ul><ul><li>Later, jenkins.build.xml could do different things than verify. </li></ul>
  12. 12. Setting up CI on Jenkins <ul><li>Login to the Jenkins server. </li></ul><ul><ul><li>Get the password in class. </li></ul></ul><ul><li>Define a CI job (by copying wattdepot-simpleapp) to: </li></ul><ul><ul><li>poll SVN every 1 minute </li></ul></ul><ul><ul><li>invoke jenkins.build.xml when changes detected. </li></ul></ul><ul><ul><li>email developers when build fails. </li></ul></ul><ul><li>Do a test commit. </li></ul><ul><li>Check to see that the build is triggered. </li></ul><ul><li>Test a “bad” commit to see that mail is generated. </li></ul>
  13. 13. Demo time
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×