18
ENTERPRISE CLOUD DEVELOPMENT 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

Marrying Jenkins and Gerrit-Berlin Expert Days 2013

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

1 Copyright ©2012 CollabNet, Inc. All Rights Reserved.ENTERPRISE CLOUD DEVELOPMENT

Berlin Expert Days 2013Enjoy Code Review Again

Marrying Gerrit with Jenkins in 20 Minutes

Johannes NicolaiDevelopment Manager, CollabNet

Dharmesh ShetaSoftware Engineer, CollabNetCollabNet Engineering Office, Potsdam, Germany

Page 2: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

2 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

CollabNet In One Slide

Page 3: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

3 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Page 4: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

4 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

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

Page 5: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

5 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

“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

What is Code Review?

Page 6: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

6 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

• Code review can be used very early in the process

[3] Caspers Jones, Patterns of Software Systems Failure and Success

The Joy in Code Review

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 %

Page 7: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

7 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

• 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

The Joy in Code Review

Page 8: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

8 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Code Review Efficiency compared to other methods [5]

Page 9: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

9 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Code Review Costs compared to other methods [5]

Page 10: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

10 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

• 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

The Pain in Code Review

Page 11: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

11 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

• 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

Gerrit = Widely Used Git Server + Code Review Tool

Page 12: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

12 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Who’s Using Gerrit in Production Today?

source: Wikipedia

Page 13: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

13 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

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

Page 14: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

14 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Tackling half baked review requests:Marrying Gerrit and Jenkins

master

CI Build: OKCI Build: OK

A1localmaster

Verified: -1(build failed)

Verified: +1(build OK)

refs/for/masterC2

push

C2

C2*

C2*

push

Reviewed: +2

C2*A1

Page 15: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

15 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

CollabNet DVD for BEDTeamForge + Gerrit Data Sheet

Software Downloads (TeamForge, Git + clients)http://www.collab.net/git

Git Blogshttp://blogs.collab.net/git

Learn More

Page 16: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

16 Copyright ©2012 CollabNet, Inc. All Rights Reserved.16 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Q&A

Page 17: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

17 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

Protection Code Quality Control IT standard compliance ALM integration Hybrid SCM

Advanced Git security Git Projects organization Code-review Replication

TeamForge = Enterprise-Grade Git Mgmt. + ALM

Basic SCM features jGit engine Native engine GitWeb

Gerrit

With TeamForge and Gerrit, Git is now ready for the enterprise. Realize all the benefits of Git, without compromising governance, security and compliance.

Page 18: Marrying Jenkins and Gerrit-Berlin Expert Days 2013

18 Copyright ©2012 CollabNet, Inc. All Rights Reserved.

The technical details we shield users from