effective development with eclipse mylyn, git, gerrit and hudson

48
Effective Development with... Eclipse, Mylyn, Git, Gerrit and Hudson (Jenkins) Chris Aniszczyk (Red Hat) Principal Software Engineer [email protected] http://aniszczyk.org

Upload: chris-aniszczyk

Post on 10-May-2015

22.813 views

Category:

Technology


0 download

DESCRIPTION

JAX London 2011

TRANSCRIPT

Page 1: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Effective Development with...Eclipse, Mylyn, Git, Gerrit and Hudson (Jenkins)

Chris Aniszczyk (Red Hat)Principal Software [email protected]://aniszczyk.org

Page 2: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

About Me

Hack on Eclipse, OSGi, Git and other things at Red Hat

Member of the Eclipse Board of Directors

Member in the Eclipse Architecture Council

I like to run! (2 minutes over of Boston qualifying ;/)

Co-author of RCP Book (www.eclipsercp.org)

Starting a new book on Git and Gerrit...

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 3: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Introduction

- Mylyn Reloaded

Hudson (Jenkins) and Mylyn

Distributed Version Control (DVCS)

Code Review with Git, Gerrit and Mylyn

Conclusion

Q&A

Agenda

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 4: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

What is Mylyn?

Mylyn is the task and application lifecycle management (ALM) framework for Eclipse. It provides... The task-focused interface that realigns the IDE around tasks so that you see only the code that's relevant A task management tool for developers A broad ecosystem of Agile and ALM integrations. There are dozens of extensions integrate Mylyn with ALM and developer collaboration tools

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 5: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Mylyn Integrates within the IDE

Mylyn reduces context switching...

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 6: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Mylyn History

2004: Task-focused interface ideas on UBC whiteboard2006: v1.0, early adopters help evolve the UI2007: v2.0, API grows from integration needs, increasing 2008: v3.0, API solidifies, extensions increase2009: v3.3, de facto ALM integration for Eclipse, dozens of extensions2010: Expansion of participation and new project creation2011: Mylyn 3.5

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 7: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Mylyn 3.4

Tasks Bugzilla Trac OSLC

Context

Versions

Docs

Java C/C++

CVS

WikiText

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 8: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Mylyn 3.5 – Restructured

Tasks Bugzilla Trac OSLC

Context

Reviews

Builds

Versions

Docs

Java C/C++

CVS Git

Hudson

WikiText RichText

OSLC

OSLC

IEEETasks Gerrit

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 9: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Introduction

Hudson (Jenkins) and Mylyn

- What is Hudson (Jenkins)

- Mylyn Builds

The Rise of Distributed Version Control (DVCS)

Code Review with Git, Gerrit and Mylyn

Conclusion

Q&A

Agenda

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 10: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

What is Hudson (Jenkins)?

Hudson is an extensible continuous integration server

Easy to use

Tons of plug-ins

Very popular within the Java community

Recently forked by the community via Jenkins

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 11: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Mylyn Builds

“The scope of the Mylyn Builds project is integration of continuous integration and build systems (eg., Hudson) within Eclipse. In addition to the seamless access to software build and assembly technologies. Mylyn users will be able to access continuous integration processes, control build execution and associate build results with tasks and context.”

http://eclipse.org/mylyn/builds

You'll find yourself leaving Eclipse less!

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 12: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Mylyn Builds Demo

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 13: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Introduction

Hudson (Jenkins) and Mylyn

Distributed Version Control (DVCS)

- Why DVCS? Why Git?

- Lessons learned at Eclipse moving to Git

- Mylyn Versions and EGit

Code Review with Git, Gerrit and Mylyn

Conclusion

Q&A

Agenda

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 14: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Version Control

Version Control Systems manage change

“The only constant is change” (Heraclitus)

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 15: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Why Version Control?

VCS became essential to software development because:

They allow teams to collaborateThey manage change and allow for inspectionThey track ownershipThey track evolution of changesThey allow for branchingThey allow for continuous integration

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 16: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

“Hey, get back to work!”

… “My code's merging” - remember those days you spent merging in changes in CVS/SVN?

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 17: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Version Control: The Distributed

Every client has a copy of the full repository locally

All repository operations are local (except sharing)

Intelligent network operations when sharing content

A very non linear revision history

Large online communities to share changes

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 18: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Software Trends and Revolution

Most major open source projects use some form of DVCS

Git, Hg, Bazaar

LinuxMySQLOpenJDKAndroidJQueryGnomeFedoraBugzilla and so on...

But why?

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 19: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Benefits of Distributed Version Control

Can collaborate without a central authority

Disconnected operations

Easy branching and merging

Define your own workflow

Powerful community sharing tools

Easier path to contributor to committer

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 20: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Collaboration

Developers can easily collaborate directly without needing a central authority or dealing with server administration costs

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 21: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Disconnected operations rule!

Developers can still be productive and not worry about a central server going down... remember the days of complaining that CVS was down and you couldn't work?

Also, there's a lighter serverload for administrators!

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 22: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Branches everywhere

Creating and destroying branches are simple operations so it's easy to experimentwith new ideas

Very easy to isolate changes

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 23: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Define your own workflow

Define your own workflow to meet your team needs. Different workflows can be adopted as your team grows without changing VCS toolsets!

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 24: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

DVCS and Building Community

Developers can easily discover and fork projects. On top of that, it's simple for developers to share their changes

“Distributed version control is all about empowering your community, and the people who might join your community” - Mark Shuttleworth

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 25: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Version Control at Eclipse

Eclipse defined a roadmap to move to Git in 2009CVS/SVN are deprecated nowEach project is moving to Git on its own timeline...

So why did Eclipse.org choose Git?

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 26: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

#1: Git-related projects at Eclipse.org

… both the core Git library (JGit) and tooling (EGit) are actively developed at Eclipse.org by a diverse set of committers and contributors with a common goal

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 27: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

#2: Git is fast

… Git is fast and scales well

*whyisgitbetterthanx.com

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 28: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

#3: Git is mature and popular

… Git is widely used and is the most popular distributed version control system

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 29: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

#4: Git community tools

… interested in taking advantage of such Git tools like Gerrit Code Review (used by the Android community) and GitHub

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 30: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Convincing management and peers was tough

- At first, everyone is resistant to change

The learning curve of DVCS systems is high

- Initially, the Eclipse tooling was “alpha”

- People refuse to drop to the CLI

Legacy is a pain in the ass!

- 200+ projects at Eclipse used CVS/SVN

- The existing VCS tooling was high quality

Eclipse.org: Challenges moving to a DVCS

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 31: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

No free lunch!

… trust me, the only way to learn DVCS is to start using it... there is a learning curve, you need to rewire your brain!

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 32: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

EGit Demo

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 33: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Introduction

Hudson (Jenkins) and Mylyn

Distributed Version Control (DVCS)

Code Review with Git, Gerrit and Mylyn

- What is Code Review?

- Introduction to Gerrit

- Mylyn Reviews Demo (Gerrit)

Conclusion

Q&A

Agenda

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 34: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

What is Code Review?

When one developer writes code, another developer is asked to review that code

A careful line-by-line critique

Happens in a non-threatening context

Goal is cooperation, not fault-finding

Often an integral part of coding process

Debugging someone else's broken code– Involuntary code review: Not so good; emotions may flare

[1] http://code.google.com/p/rietveld/downloads/detail?name=Mondrian2006.pdf

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 35: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Code Review Benefits

Four eyes catch more bugs§ Catch bugs early to save hours of debugging

Enforce coding standards§ Keep overall readability & code quality high

Mentoring of new developers § Learn from mistakes without breaking stuff

Establish trust relationships § Prepare for more delegation

Good alternative to pair programming§ asynchronous and across locations

[1] http://code.google.com/p/rietveld/downloads/detail?name=Mondrian2006.pdf

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 36: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit Code Review

Gerrit is a Code Review system based on JGit http://code.google.com/p/gerrit/

Also serves as a git server adding access control and workflow

Used by • Android https://review.source.android.com/• JGit, EGit http://egit.eclipse.org/r/• Google, Red Hat, SAP, …

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 37: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

History: Google and code review tools

Mondrian (Guido van Rossum)• based on Perforce, Google infrastructure• Google proprietary

Rietvield (Guido van Rossum)• based on Subversion• Open Source hosted on GoogleApp Engine

Gerrit (Shawn Pearce)• started as a fork of Rietvield• based on JGit and GWT• Open Source (Android)• Apache 2 license

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 38: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

One Branch One Feature

Master branch contains only reviewed and approved changes

• master moves from good to better state after each (approved) change

Each feature branch is based on master branch• stable starting point

A change can really be abandoned because• no other approved change can depend on a not

yet approved change• Gerrit will automatically reject a successor

change of an abandoned change

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 39: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit – Lifecycle of a Change

a

master

topic

1

• create local topic branch• commit change• push it for review• do review• automated verification

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 40: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit – Lifecycle of a Change

c

b

a1

2

mastertopic

3

a

master

topic

1

• create local topic branch• commit change• push it for review• do review• automated verification

• refine based on review• push new patchsets until review votes ok

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 41: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit – Lifecycle of a Change

c

b

a1

2

mastertopic

3

a

master

topic

1

• create local topic branch• commit change• push it for review• do review• automated verification

• refine based on review• push new patchsets until review votes ok

c

b

a1

2

master

topic

3

d

• Submit may lead to server-side merge• or merge / rebase before push

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 42: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit Workflow

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 43: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit

http://egit.eclipse.org/r/ - change,825Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 44: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Gerrit and Mylyn Reviews Demo

http://egit.eclipse.org/r/ - change,825Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 45: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

History of Version Control (VCS)

Hudson (Jenkins) and Mylyn

Distributed Version Control (DVCS)

Code Review with Git and Gerrit

Conclusion

Q&A

Agenda

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 46: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Conclusion

The Mylyn project restructuring is a sign of maturity

The future of version control is distributed!

Mylyn Builds works great with Hudson (Jenkins)

Gerrit enables a nice code review workflow

Mylyn Reviews integrates with Gerrit

Developing with Mylyn saves time!

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 47: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Git Resources

http://git-scm.com/documentation is your friend

Watch Linus' talk at Googlehttp://www.youtube.com/watch?v=4XpnKHJAok8

Read the Pro Git book - http://progit.org/book/

Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

Page 48: Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

Q&A

Evolution of Version Control in Open Source | © 2010 by Chris AniszczykEffective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk