Mais conteúdo relacionado
Semelhante a Marrying Jenkins and Gerrit-Berlin Expert Days 2013 (20)
Marrying Jenkins and Gerrit-Berlin Expert Days 2013
- 1. Berlin Expert Days 2013
Enjoy Code Review Again
Marrying Gerrit with Jenkins in 20 Minutes
Johannes Nicolai
Development Manager, CollabNet
Dharmesh Sheta
Software Engineer, CollabNet
CollabNet Engineering Office, Potsdam, Germany
ENTERPRISE CLOUD DEVELOPMENT
1 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 2. CollabNet In One Slide
2 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 3. 3 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 4. Agenda
• What is Code Review?
• The Joy in Code Review
• The Pain in Code Review
• Enjoy Code Review Again: Introducing Gerrit and Jenkins
• Demo Workflow Explained
• Live Demo
• Resources
• Q&A
4 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 5. What is Code Review?
“Code review is systematic examination (often known as peer
review) of computer source code. […] Reviews are done in
various forms such as pair programming, informal
walkthroughs, and formal inspections.” [1]
We will not cover formal inspections methods and pair
programming here but concentrate on informal walk
throughs, typically referred as Informal Peer review
“In software development, peer review is a type of software
review in which a work product (document, code, or other) is
examined by its author and one or more colleagues, in order to
evaluate its technical content and quality.” [2]
[1] Kolawa, Adam; Huizinga, Dorota (2007). Automated Defect Prevention: Best Practices in Software Management. Wiley-IEEE Computer Society Press. p. 260. ISBN 0-470-
04212-5.
[2] http://en.wikipedia.org/wiki/Software_peer_review
5 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 6. The Joy in Code Review
• Code review can be used very early in the process
Phase Recovery Prospects Success Factor
Early Planning Excellent 95 %
Requirements Excellent 90 %
Initial Design Very Good 80 %
Detail Design Good 65 %
Coding Fair 45 %
Integration Poor 30 %
Testing Very Poor 15 %
Deployment Non existent 0%
Maintenance Non existent 0%
[3] Caspers Jones, Patterns of Software Systems Failure and Success
6 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 7. The Joy in Code Review
• Peer review does not only apply to executable source code
– Design/requirement specifications
– Documentation
– XML schema
• Some quality aspects can only be verified using code review
– Readability/changeability of the code
– Meaningful qualifiers / object names / functions
• Great source for knowledge transfer and early
design/architecture conflict detection
7 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 8. Code Review Efficiency compared to other methods [5]
8 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 9. Code Review Costs compared to other methods [5]
9 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 10. The Pain in Code Review
• Less than 50 percent of software applications are developed using code review [5]
[5] C. Jones, The Economics of Software Quality, Capers Jones, Olivier Bonsignour and Jitendra Subramanyam, Addison-Wesley Longman, 2011
• Ego challenges – Welcome to the world of gamification (after talk)
• Half baked review requests killing motivation – ‘The demo tape problem‘
– Many code review requests do not meet basic quality gates
• Compiles/builds
• Passes unit / integration tests
• Meets coding standards and metrics
• No IP violations
• Review Tool challenges – ‘Context switching par excellence‘
– Creating patches
– Uploading patches
– Inspecting patches
– Downloading patches
– Applying patches
– Building patches
– Providing feedback
– Reworking patches
– Merging patches
10 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 11. Gerrit = Widely Used Git Server + Code Review Tool
• 100% pure Java SSH and HTTP Git backend
– Scalable and suitable for large Enterprises
• Web-based and Command Line administration
– Users and Groups
– Project and branch security (read and write)
• Collaboration and Code-review
– B2B integration at code-level
– Communicate and share code knowledge in the Team
– Enforce workflow and code quality
• The most successful open source code review
– Android OS
– Eclipse, OpenStack, Qt, CouchDB and many others
11 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 12. Who’s Using Gerrit in Production Today?
source: Wikipedia
12 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 13. Jenkins = Most popular Open Source CI
• Has hundreds of plugins to
– Interact with various SCMs (Git, SVN, CVS, …)
– Build software (ant, maven, gradle, make)
– Run unit/integration tests (JUnit, Selenium, …)
– Perform static code analysis
(findbugs, checkstyle, PMS, Sonar, …)
• Works brilliantly together with Gerrit over
Gerrit Trigger Plugin
– Keeps ssh connection open to learn about new
review requests immediatly
– Builds and verifies all configures quality gates
(tests, coding conventions, code KPIs, you name it)
– Sets ‘verified’ flag in review request according to
result of verification build (either +1 or -1)
– If Jenkins sets -1, then further code review isn’t
possible, developer has to either re-work or
abandon change
13 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 14. Tackling half baked review requests:
Marrying Gerrit and Jenkins
CI Build: OK CI Build: OK
master
A1 C2*
Verified: -1 Verified: +1
(build failed) (build OK)
C2 C2* refs/for/master
Reviewed: +2
push push
local
A1 C2 C2* master
14 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 15. Learn More
CollabNet DVD for BED
TeamForge + Gerrit Data Sheet
Git Blogs
http://blogs.collab.net/git
Software Downloads (TeamForge, Git + clients)
http://www.collab.net/git
15 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 16. Q&A
16 Copyright ©2012 CollabNet, Inc. All Rights Reserved.
- 17. TeamForge = Enterprise-Grade Git Mgmt. + ALM
Gerrit
Basic SCM features Protection
jGit engine Code Quality
Advanced Git security Control
Native engine
Git Projects organization IT standard compliance
GitWeb
Code-review ALM integration
Replication Hybrid SCM
With TeamForge and Gerrit, Git is now ready for the enterprise. Realize all the
benefits of Git, without compromising governance, security and compliance.
17 Copyright ©2012 CollabNet, Inc. All Rights Reserved.