Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git, Gerrit and Jenkins

alblue
October 20, 2011

Git, Gerrit and Jenkins

A talk on combining Git, Gerrit and Jenkins, based on existing material delivered via this blog post:

http://alblue.bandlem.com/2011/02/gerrit-git-review-with-jenkins-ci.html
http://vimeo.com/20084957

alblue

October 20, 2011
Tweet

More Decks by alblue

Other Decks in Technology

Transcript

  1. Git, Gerrit and Jenkins Code Review and Automated Build Alex

    Blewitt @alblue SkillsMatter October 2011
  2. Git • Matthew has talked about Git extensively • Ask

    @matthewmccull for more details :) • Alternatively look for Git Tip of the Week • #gtotw • alblue.bandlem.com/search/label/gtotw
  3. Gerrit • Git-backed review system • Used by Eclipse, Android

    • Acts as a front-end to a central Git repo • When review complete, auto-merged
  4. Jenkins/Hudson • Automated build platform • Can be used with/without

    Gerrit/Git • Has triggers to hook into events • Hudson donated to Eclipse Foundation • Jenkins donated to SPI
  5. Team development • Work as a team • Merge to

    centralised repository • Review all code changes ✓But without affecting others
  6. Attempt I • Review before commit ✓No cruft in repository

    ✓Doesn’t affect others ✴No guarantee reviewed == commited
  7. Attempt II • Review after commit ✓Guarantee reviewed == commited

    ✴Cruft in repository ✴May affect others
  8. Attempt III • Review after commit on unique branch ✓Guarantee

    reviewed == commited ✓No cruft in repository on main branch ✓Will not affect others
  9. Pushing • Pushing to Gerrit creates a new branch •

    master:refs/for/master • Review comments can be added to files • Can compare before/after changes • Change-Id allows patch sets per branch
  10. Checking it out • Jenkins can be told when a

    change occurs • Can automatically compile and test code • Can generate test report • Can mark success/failure in Gerrit
  11. Jenkins Gerrit Trigger • Can install the Gerrit Trigger Plugin

    • Automatically installs Git plugin • Set refspect to pull as $GERRIT_REFSPEC • Build Trigger as Gerrit Event • Project must match project(s) • Project Path ** Branch Path **
  12. Permissions • Gerrit can act as a permissioned keeper •

    Merges • Push-to-branch directly (skip review) • Clone/fetching • Review/Submit
  13. Commit Hooks • Can be configured to auto add Change-Id

    • Git • scp -P 29418 gerrit:/hooks/commit-msg • EGit • git config gerrit.createchangeid true
  14. Merging • Can configure merge options per-project • Fast Forward

    Only • Merge If necessary • Always Merge • Cherry Pick
  15. Review Notes • Gerrit 2.2+ stores more info in Git

    repos • Permissions are stored refs/meta/config • Inherited from All-Projects.git • Review data encoded in Git Notes • refs/notes/review • git log --show-notes=*
  16. Future • Currently (2.2) a SQL DB is still required

    • SSH keys, user information • Project metadata • More info is moving to Git repositories • Review notes • Configuration
  17. Git, Gerrit and Jenkins Code Review and Automated Build Alex

    Blewitt @alblue SkillsMatter October 2011