Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

26,203 views
25,725 views

Published on

JAX London 2011

Published in: Technology

Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson

  1. 1. Effective Development with... Eclipse, Mylyn, Git, Gerrit and Hudson (Jenkins)Chris Aniszczyk (Red Hat)Principal Software Engineerzx@redhat.comhttp://aniszczyk.org
  2. 2. About MeHack on Eclipse, OSGi, Git and other things at Red HatMember of the Eclipse Board of DirectorsMember in the Eclipse Architecture CouncilI 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
  3. 3. AgendaIntroduction - Mylyn ReloadedHudson (Jenkins) and MylynDistributed Version Control (DVCS)Code Review with Git, Gerrit and MylynConclusionQ&A Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  4. 4. What is Mylyn?Mylyn is the task and application lifecyclemanagement (ALM) framework for Eclipse. Itprovides...The task-focused interface that realignsthe IDE around tasks so that you see onlythe code thats relevantA task management tool for developersA broad ecosystem of Agile and ALMintegrations. There are dozens of extensionsintegrate Mylyn with ALM and developercollaboration tools Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  5. 5. Mylyn Integrates within the IDEMylyn reduces context switching... Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  6. 6. Mylyn History2004: Task-focused interface ideas on UBC whiteboard2006: v1.0, early adopters help evolve the UI2007: v2.0, API grows from integration needs, increasing2008: v3.0, API solidifies, extensions increase2009: v3.3, de facto ALM integration for Eclipse, dozens ofextensions2010: Expansion of participation and new project creation2011: Mylyn 3.5 Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  7. 7. Mylyn 3.4 Tasks Bugzilla Trac OSLC Context Java C/C++ Versions CVS Docs WikiText Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  8. 8. Mylyn 3.5 – Restructured Tasks Bugzilla Trac OSLC Context Java C/C++ Versions CVS Git OSLC WikiText RichText Docs Builds Hudson OSLC Reviews Tasks Gerrit IEEE Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  9. 9. AgendaIntroductionHudson (Jenkins) and Mylyn - What is Hudson (Jenkins) - Mylyn BuildsThe Rise of Distributed Version Control (DVCS)Code Review with Git, Gerrit and MylynConclusionQ&A Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  10. 10. 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
  11. 11. 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 Youll find yourself leaving Eclipse less! Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  12. 12. Mylyn Builds Demo Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  13. 13. AgendaIntroductionHudson (Jenkins) and MylynDistributed Version Control (DVCS) - Why DVCS? Why Git? - Lessons learned at Eclipse moving to Git - Mylyn Versions and EGitCode Review with Git, Gerrit and MylynConclusionQ&A Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  14. 14. 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
  15. 15. Why Version Control? VCS became essential to software development because: They allow teams to collaborate They manage change and allow for inspection They track ownership They track evolution of changes They allow for branching They allow for continuous integration Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  16. 16. “Hey, get back to work!” … “My codes merging” - remember those days you spent merging in changes in CVS/SVN? Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  17. 17. 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
  18. 18. Software Trends and Revolution Most major open source projects use some form of DVCS Git, Hg, Bazaar Linux MySQL OpenJDK Android JQuery Gnome Fedora Bugzilla and so on... But why? Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  19. 19. 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
  20. 20. 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
  21. 21. 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 couldnt work? Also, theres a lighter server load for administrators! Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  22. 22. Branches everywhereCreating and destroying branches are simpleoperations so its easy to experimentwith new ideasVery easy to isolate changes Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  23. 23. 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
  24. 24. DVCS and Building CommunityDevelopers can easily discover and fork projects. Ontop of that, its simple for developers to share theirchanges“Distributed version control is all about empoweringyour community, and the people who might join yourcommunity” - Mark Shuttleworth Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  25. 25. Version Control at Eclipse Eclipse defined a roadmap to move to Git in 2009 CVS/SVN are deprecated now Each 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
  26. 26. #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
  27. 27. #2: Git is fast … Git is fast and scales well *whyisgitbetterthanx.com Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  28. 28. #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
  29. 29. #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
  30. 30. Eclipse.org: Challenges moving to a DVCSConvincing management and peers was tough - At first, everyone is resistant to changeThe learning curve of DVCS systems is high - Initially, the Eclipse tooling was “alpha” - People refuse to drop to the CLILegacy is a pain in the ass! - 200+ projects at Eclipse used CVS/SVN - The existing VCS tooling was high quality Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  31. 31. No free lunch!… trust me, the only way to learn DVCS is to start usingit... there is a learning curve, you need to rewire yourbrain! Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  32. 32. EGit Demo Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  33. 33. AgendaIntroductionHudson (Jenkins) and MylynDistributed Version Control (DVCS)Code Review with Git, Gerrit and Mylyn - What is Code Review? - Introduction to Gerrit - Mylyn Reviews Demo (Gerrit)ConclusionQ&A Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  34. 34. What is Code Review?When one developer writes code, another developeris asked to review that codeA careful line-by-line critiqueHappens in a non-threatening contextGoal is cooperation, not fault-findingOften an integral part of coding processDebugging someone elses 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
  35. 35. Code Review BenefitsFour eyes catch more bugs § Catch bugs early to save hours of debuggingEnforce coding standards § Keep overall readability & code quality highMentoring of new developers § Learn from mistakes without breaking stuffEstablish trust relationships § Prepare for more delegationGood 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
  36. 36. 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
  37. 37. 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
  38. 38. 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
  39. 39. Gerrit – Lifecycle of a Change • create local topic topic branch master • commit change 1 • push it for review a • do review • automated verification Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  40. 40. Gerrit – Lifecycle of a Change • create local topic topic branch master • commit change • push it for review 1 • do review • automated a verification topic master c • refine based on 3 review • push new patchsets b 2 until review votes ok 1 a Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  41. 41. Gerrit – Lifecycle of a Change • create local topic master topic branch master • commit change • push it for review d topic 1 • do review a • automated verification c 3 b topic master 2 c • refine based on a 1 3 review • push new patchsets b until review votes ok 2 • Submit may lead to server-side merge 1 a • or merge / rebase before push Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  42. 42. Gerrit Workflow Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  43. 43. Gerrit Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris http://egit.eclipse.org/r/ Aniszczyk - change,825
  44. 44. Gerrit and Mylyn Reviews Demo Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris http://egit.eclipse.org/r/ Aniszczyk - change,825
  45. 45. AgendaHistory of Version Control (VCS)Hudson (Jenkins) and MylynDistributed Version Control (DVCS)Code Review with Git and GerritConclusionQ&A Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  46. 46. ConclusionThe Mylyn project restructuring is a sign of maturityThe future of version control is distributed!Mylyn Builds works great with Hudson (Jenkins)Gerrit enables a nice code review workflowMylyn Reviews integrates with GerritDeveloping with Mylyn saves time! Effective Development with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk
  47. 47. Git Resources http://git-scm.com/documentation is your friend Watch Linus talk at Google http://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
  48. 48. Q&A Effective of Version Control in Open Source | © 2010 by Chris Aniszczyk EvolutionDevelopment with Mylyn, Hudson, Git and Gerrit | © 2011 by Chris Aniszczyk

×