Upload
opensource-connections
View
1.477
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Slides for the CI Tutorial delivered at STPcon 2009.
Citation preview
Core Principles of CISTPcon
1
Intro
2
Who Am I?• Principal of OpenSource
Connections
• Contributer to CruiseControl and Continuum CI projects
• Member of Apache Software Foundation
• Presenter at conferences (OSCON, ApacheCON, jTDS, ExpoQA, STPcon)
• Fascinated by the art of software development
3
Author
4
Father
5
Agilista
6
Schedule
Core Principles of CI
Break
Hudson to the Rescue
Agile and CI
9 to 10:15
15 minutes
10:30 to 11:15
11:15 to 12
7
Rules of the Road
• Cell phones on Silent.
• Ask Questions!
• Feel free to get up and move around the room.
8
What is CI?
9
Conceptual
10
Definition
a fully automated and reproducible build, including testing, that runs many times a day - Martin Fowler
http://martinfowler.com/articles/continuousIntegration.html
11
Martin Fowler
• Coined the term Continuous Integration
• Chief Scientist for ThoughtWorks
• Speaks and Blogs on software:
• http://martinfowler.com/
12
Mapping
diagram credit to Brian Di Croce @ http://blog.briandicroce.com/2008/03/17/setting-up-a-continuous-integration-environment-preface/
13
Activity
Turn to the person next to you, and see how many non-obvious things you have in common.
14
Arm Bands!• Elisabeth Hendrickson is
TestObsessed.com
• Focuses on Testing in the Agile community
• Really great blogger: Specialized Test Management Systems are an Agile Impediment and Adventures with Auto-Generated Tests and RSpec are typical posts
15
CI in a nutshell
16
Demo
17
People
18
Version Control Repository
19
CI Server
20
Build Script
• Automated Script is Key!
• Needs to be robust and simple
21
Feedback Mechanism
From: [email protected] Subject: [CruiseControl] agenda_direcciones build 370 fixed Date: October 7, 2008 2:22:50 PM EDT To: [email protected]
The build has been fixed.
CHANGES-------New revision 370 detectedRevision 370 committed by epugh on 2008-10-07 18:22:03mysql esta mejor que sqlite M /branches/ERIC_EXPO_08_DEMO/agenda_direcciones/config/database.yml
See http://cruise.opensourceconnections.com:3333/builds/agenda_direcciones/370 for details.
22
photo credit to Jay Grieves @ www.bigswingingdeveloper.com
23
Aspects of CI
24
Source Code Compilation
• Eclipse “Export to War” is NOT the solution
25
Database Integration• Database is integral to
your code
• DDL, stored procedures are treated as source
• Involve your DBA in your project
• DBUnit for Java projects!
• Don’t require a multi gig database file to run tests!
• Look at techniques like fixtures or mock objects to reduce database coupling
• Developers need database sandbox
26
Testing• Testing proves the intent
of the programmer was met.
• Typically provides the “checkability” that James Bach talks about
• Multiple Levels of testing
with out testing, CI is just a glorified compiler- Eric Pugh
27
Inspection• Code Coverage
• Code Complexity
• Copy’n’pasting
• Architectural Standards
• Lint Checking
• Static Analysis
28
Deployment
• Turns what is normally a difficult process into a non event...
• ant deploy
• Simplifies standup new environments
29
Documentation
30
Feedback• Email
• IRC
• Devices
• Blog Posts
• Twitter Notifications
• Tray Icons
31
So What is the Value?
32
Life with out CI• Unstable code, integration is difficult
• Many build errors reported
• Only one person on the team can build the entire project
• Getting “test ready” product is hard
• Feedback cycle is long
• Same bug keeps coming back
Every day is a struggle to be productive33
Life with CI
• The build process is simple and repeatable
• Elimination of Human Error
• Bugs stay fixed!
• Feedback cycle is very rapid
Every day you know you can produce better software!34
Risk Reduction
• What is in the build?
• What has changed between builds?
• How do I verify functionality?
35
Reduce Human Error
36
My Ah-hah! moment
37
Reduce Repetitive Processes
• DRY: Don’t Repeat Yourself
• Script Everything!
• “ant deploy”
38
Make Painful Things Painless!
photo credit to Paul Duvall @ http://www.integratebutton.com/
39
Produce Deployable Software
• It’s what we are here to do!
• Always in a “Demo Ready” state
• No last minute administrivia tasks to get the product ready
• Installer is built
• Documentation is written
• Changelog is written
40
Enable Project Visibility41
42
Increase Project Confidence
43
44
photo credit to ThoughtWorks
45
Facilitate Communication
46
photo credit to Eric Pugh @ www.opensourceconnections.com
47
48
49
Activity
Exquisite corpse (also known as "exquisite cadaver" or "rotating corpse") is a method by which a collection of words or images is
collectively assembled, the result being known as the exquisite corpse or cadavre
exquis in French.
50
What Prevents Teams from Using CI?
51
Cultural Challenges
52
Fear of Commitment
• Developers and Testers need to commit changes frequently!
• Incremental small changes make finding integration issues simpler
drawing credit to Tom Armitage @ http://infovore.org/archives/2007/03/14/the-continuous-integration-barometer/
53
This isn’t 198454
Fear of Blame55
• CI needs a champion who acts as the ambassador to the leaders of the organization.
• Thought leaders in the organization who can help encourage team to accept the process changes that CI brings
• A very successful test case
• A greenfield project if possible
56
57
Structural Challenges
58
Testability• Modularity?
• Coupling to underlying platform?
• Requires external services to be up and available for testing?
• Perform code complexity analysis to see if some parts are more amenable to testing.
59
Tight Coupling
photo credit to Jay Grieves @ www.bigswingingdeveloper.com
60
CI Tool Stability Challenges
61
Invest in CI Server• The CI system must be as well
maintained as the Source Control system.
• The CI system performs builds very quickly.
• Who has responsibility for CI? It’s very important to have a “throat to choke”.
• No false alarms. If there are false alarms then the team loses confidence in the CI system.
X✓
62
Monkey CIphoto credit to Eric Pugh @ www.opensourceconnections.com
63
When Should You Adopt CI?
64
From good CI
to
great CI!
65
10 minute rule
photo credit to Jay Grieves @ www.bigswingingdeveloper.com
66
Multi Stage CI
• Reduce the amount of integration required
• Teams integrate as modules are marked as ready.
• Maven2 was built with this in mind!
Damon Poole @ http://damonpoole.blogspot.com/2008/01/advanced-multi-stage-continous.html
67
Break up Tests
• “preflight” or “smoke” tests
• longer integration tests
• periodic full site generation and report generation
68
Predictive Testing
• Some commercial tools support predicting which tests will fail based on previous behavior, and running those first!
69
Cup of Coffee Metric
• Builds shouldn’t take any longer!
• Getting a cup of coffee or drink of water breaks up your day
• Gives you a chance to review your work
• Requires a moduler fast build
http://pauljulius.com/blog/2009/09/14/cup-of-coffee-metric-for-continuous-integration/
What happens in the time it takes to get a cup of coffee can tell you a lot about the quality of your continuous integration system. - Paul Julius
70
Paul Julius
• co-founder of CITCON
• Original developer of CruiseControl
• Speaks and Blogs on CI extensively
• http://pauljulius.com/blog/
71
Virtuous Circle
• Metrics are hard to get
• Teams (Developers?) rebel against on high management
• Need good processes that support and encourage other good processes
72
HackyStat
73
CI isn’t one specific method
74
Enterprise CI Maturity Model
!"#$%&"!''!()*+,"$-!).$/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
654""+D-31#'43+:)/45#+?11)""
,$"'1+:)/45#+?3$&A"'"
95)3*'3C
654""J.'&4?3$&A"'"
G5)*'1#'K)24*)&'3C
!"#$!%&'
(
Came out of discussions at 2009 CITcon. Developed by Eric
Minick of UrbanCode
75
!"#$%&'"()*+,-'&*+.#)/"
0)*'1$#)*+,-'&*+2$1('3)
.4&'*+
.4-51)+643#54&
789:;0<69;:= 8;>76! 789!:2!07?9! ?0>?86!0 78.?8!
?-#4+!@)1-#)+,-'&*+.#)/"
0)/)3*)31A+:)/4"'#45A
,-'&*+6&-"#)5
643#'3-4-"+,-'&*"
95$1B'3C+!"#$%&!'(#%)*
.)1-5)+!"#$%&!'(#%)*
,-'&*+D54E+>2+.3$/"(4#"
!"#$%#&
'
76
H)&/)5+.15'/#"
789:;0<69;:= 8;>76! 789!:2!07?9! ?0>?86!0 78.?8!
D-&&A+.15'/#)* .)&IJ.)5K'1)+9)"#+0)/&4A"
?-#4+0)/&4A+#4+;3)+!3KL
24"#&A+.#$3*$5*'M)*
G-"(J,-##43+G54*+0)/&4AE)3#
N$#)*O+?-#4E$#'1+G54E4#'43"
D-&&A+.#$3*$5*'M)*+0)/&4A"
?-#4E$#'1+G54*-1#'43+0)/&4A"
!"#$%
&'(
)
77
.4E)++9)"#+?-#4E$#'43
789:;0<69;:= 8;>76! 789!:2!07?9! ?0>?86!0 78.?8!
:)C5)""'43+9)"#"+:-3+P'#(+,-'&*
.4E)+.#$#'1+?3$&A"'"+<")*
?-#4E$#)*+D-31#'43$&+9)"#"
!@#)3"'K)+<3'#+9)"#"
!@#)3"'K)+?-#4E$#)*+D-31#'43+9)"#"
:'"BJ,$")*+2$3-$&+9)"#"
.)1-5'#A+.1$3"
QRRS+9)"#+64K)5$C)
!"#!$%
&
78
944&J,$")*+:)/45#"
>'"'%'&'#AT+:)/45#+:-33)5
789:;0<69;:= 8;>76! 789!:2!07?9! ?0>?86!0 78.?8!
.'&4)*+:)/45#'3C
G-%&'"(+F$#)"#+:)/45#"
H'"#45'1$&+:)/45#"
654""+D-31#'43+:)/45#+?11)""
,$"'1+:)/45#+?3$&A"'"
95)3*'3C
654""J.'&4?3$&A"'"
G5)*'1#'K)24*)&'3C
!"#$!%&'
(
79
What about People?
80
CI on a Dollar a Day
• Build Computer
• Ridiculous Toy
• Annoying Bell
• Automated Build
• Group Agreement
"From now on, our code in revision control will always build successfully and pass its tests.". - James Shore
http://jamesshore.com/Blog/Continuous-Integration-on-a-Dollar-a-Day.html
81
credit to Paul Julius @ http://www.anthillpro.com/blogs/anthillpro-blog/2009/09/11/enterprise_ci_cultural_maturity.html
82
Lots of advanced
techniques!
credit to Christine Mitterbauer @ Microdoc
83
Perils of CI
84
Getting too focused on Green Bar
Glare of the Green Bar in CI can obscure issues with your product- James Bach
85
Making CI the core of too many systems
86
Making decisions based on your available
tooling
87
Selecting a CI System
88
Approaches
• Big Hand Rolled System
• Cloud Based Solution
• Completely Hosted
89
Hand Rolled SystemPros Cons
Complete control of configuration
Rolling your own can take more work
Data and code inside firewall
Dealing with disparate platform elements is harder
Works with any type of system
Multiple kinds of projects can be hard to manage
CheapestMust provide Sys Admin
work
90
CI Matrix Matrix of differences between CI tools: http://tinyurl.com/39hol7
91
Cloud Based SolutionPros Cons
Very Scalable Data and Code outside firewall
Use CPU resources only when needed
Cloud computing still new
Deal well with multiple kinds of projects
GUI apps hard to test
?Must provide Sys Admin
work
92
CI in a Box
• Amazon EC2 Hosted instance
• http://www.ciinabox.com/
93
Hosted SolutionPros Cons
Very Scalable Typically limited in language support
No Sys Admin tasks data and code outside firewall
Pricing is fairly straightforward
GUI apps hard to test
? vendors are still new
94
RunCodeRun.com
95
MikeCI.com
96
Where to Next?
97
CITCON
• Open Spaces Style
• Twice a year, US and International
• Raleigh-Durham, NC, April 2010
• http://www.citconf.com/
98
99
CI Yahoo Group
http://tech.groups.yahoo.com/group/citcon/
100
The Book Continuous Integration:
Improving Software Quality and Reducing Risk
101