Gerrit Code Review with GitHub plugin

Luca Milanesio
Luca MilanesioDirector at GerritForge Ltd
Luca@gerritforge.com
http://www.gerritforge.com
Twitter: @gitenterprise
GitHub plugin for …
Luca Milanesio
GerritForge
gerritGerrit Code Review
Platinum Sponsor
2 .io
About Luca
• Luca Milanesio
Co-founder of GerritForge
• over 20 years of experience
in Agile Development
SCM and ALM worldwide
• Contributor to Jenkins
since 2007 (and previously Hudson)
• Git SCM mentor
for the Enterprise since 2009
• Contributor to Gerrit Code Review community since 2011
3 .io
About GerritForge
Founded in 2009 in London UK
Mission: Agile Enterprise
Products:
4 .io
Agenda
 Fork+Pull request or Change review ?
 People says …
 My experience say …
 Plugging two worlds together
 echo "github" | sed -e "s/git/gerrit/"
 Pull requests and Repo replication
 What do YOU think ?
5 .io
Two divided review worlds
BRANCH
+
PULL
REQUEST
CHECKOUT
+
AMEND
6 .io
Fork + Pull request
GitHub BitBucket GitLab Gitorious + others …
> 10M repositories > 4M users
SourceRepo
mastera1c 2df f9a
fork
masterdec 6fa 7a1
7 .io
Change review (rebase example)
Gerrit GitBlit
+ others?
SourceRepo
mastera1c 2df 7a1
dec 6fa 7a1 changes/27/1627/*
amend amend
8 .io
Two worlds at a glance
1. BRANCH
2. SCORE THE
BRANCH
3. MERGE ALL
COMMITs in
BRANCH
1. CHECKOUT
2. SCORE THE
COMMIT
3. MERGE ONLY the
REVIEWED
COMMIT
9 .io
WHAT PEOPLE
SAY ?
10 .io
There are two fundamental problems with single-
patch review systems:
1. They encourage lumping at-best-weakly-related
changes together.
2. They encourage you to hide your history.
[http://bit.ly/1hhQkcA]
The pull-request system looks like an incredible
easy way to contribute to any project hosted on
Github [but] doing any proper and useful
contribution to a software is never done right the
first time.
But as a software maintainer you'll end up with
pull-request you'll never get finished unless you
wrap things up yourself.
[http://bit.ly/1o7HIb6]
A big advantage in Github's favor is the number of
developers that are familiar with it compared to
Gerrit.
Gerrit can be popular with Git power-users, but
friction-free use of it requires intermediate or
advanced git knowledge, and tolerance of a steep
learning curve.
[http://bit.ly/1cJV8IJ]
I have no problem with people using github as a
hosting site, but in order for *me* to pull from
github, you need to
(a) make a real pull request […]: real explanation,
proper email addresses, proper shortlog, and
proper diffstat.
(b) since github identities are random, I expect
the pull request to be a signed tag
[http://bit.ly/1iONQ4L]
11 .io
MY OWN
(OpenSource +
Enterprise)
[humble]
EXPERIENCE …
12 .io
Review model
DO NOT make git bisect + git cherry-pick useless
DO NOT throw commits over the fence
(e.g. “I’ve made the pull request, now it’s up to you”)
13 .io
Governance
DEFINE rules for your project
TRUST your identities and roles
14 .io
Social engagement
MAKE your project visible
MAKE collaboration easy and fun
15 .io
Growth
PLAN for collaboration model to scale
AVOID explosion of forks and pending pull-requests
16 .io
Can we take both worlds ?
+ = ?
17 .io
GitHub plugin for Gerrit Code Review
https://gerrit-review.googlesource.com/#/admin/projects/plugins/github
1. Imports Pull Requests  Gerrit Changes / Topics
2. Reuses GitHub identity using Gerrit auth rules
3. Replication: keeps presence on http://github.com
4. Prevents explosion of unmanaged forks
5. Avoid GitHub spamming  one-email-per-change
18 .io
Gerrit and GitHub? Who is ever gonna use it?
June 2014 Statistics
select count(*) from accounts = 1664 users
select count(*) from changes = 3654 changes
select count(*) from patch_sets = 4720 patch-sets
find . -name '*.git' | wc –l = 5022 repositories
du -s -h git = 140 GBytes
19 .io
THIS IS COOL !
How can use it ?
20 .io
SPEEDY WAY
http://GerritHub.io/login
21 .io
DEMO TIME
[http://www.youtube.com/watch?v=jeWTvDad6VM]
22 .io
HACKY WAY
Build the plugin from source
23 .io
Step#1 - GitHub OAuth 2.0 application keys
https://github.com/settings/applications/new
Your server URL
(hostname / port Gerrit
will listen to)
OAuth 2.0 callback URL
is
Your server URL +
/oauth
24 .io
Step#2 – Get OAuth Client-Id / CLient-Secret
GitHub OAuth 2.0 credentials for Gerrit
integration
25 .io
Step#3 – Download Gerrit 2.10 (master)
http://ci.gerritforge.com/job/Gerrit-master
26 .io
Step#4 – build GitHub plugin
 git clone https://gerrit.googlesource.com/plugins/github && cd github
 mvn install
[…]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.755s
[INFO] Finished at: Sat Mar 15 19:16:23 GMT 2014
[INFO] Final Memory: 57M/449M
[INFO] ------------------------------------------------------------------------
27 .io
Step#5 – install OAuth filter and GitHub plugin
> export GERRIT_SITE=/var/gerrit
> mkdir –p $GERRIT_SITE/lib
> cp github-oauth/target/github-oauth*.jar $GERRIT_SITE/lib
> mkdir –p $GERRIT_SITE/plugins
> cp github-plugin/target/github-plugin*.jar $GERRIT_SITE/plugins
28 .io
Step#6 – Gerrit setup + replication + singleusergroup
> cd $GERRIT_SITE && java –jar release.war init –d $GERRIT_SITE
*** Gerrit Code Review 2.9-rc1-779-g90fac34-dirty
***
[…]
*** User Authentication
***
Authentication method ? HTTP
Get username from custom HTTP header ? Y
Username HTTP header ? GITHUB_USER
*** Plugins
***
Install plugin singleusergroup version v2.9-rc2-536-g79393b2 [y/N]? y
Install plugin replication version v2.9-rc2-536-g79393b2 [y/N]? y
29 .io
Step#7 – Configure GitHub integration
[…]
*** GitHub Integration
***
GitHub URL ? https://github.com
Use GitHub for Gerrit login ? Y
ClientId ? 732819a7b9c9d9a98
ClientSecret ? 6271627a6a7s6s718173642718a9bcacd
HTTP Authentication Header [GITHUB_USER]:
30 .io
Replay presentation: http://slideshare.net/lucamilanesio
Sign-in: http://gerrithub.io/login
Gerrit book: http://gerrithub.io/book
Learn more about
20% OFF Book discount for
33 Degree.org User Conference
Book CODE: dg7jnZ
eBook CODE: Wi86Zh
1 of 31

Recommended

Dependency injection using Google guice by
Dependency injection using Google guiceDependency injection using Google guice
Dependency injection using Google guiceAman Verma
180 views37 slides
Gerrit: how to cook a plugin in only 10 mins by
Gerrit: how to cook a plugin in only 10 minsGerrit: how to cook a plugin in only 10 mins
Gerrit: how to cook a plugin in only 10 minsLuca Milanesio
10.9K views26 slides
Introduction to GitHub Actions by
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsBo-Yi Wu
19.3K views57 slides
Git & GitHub WorkShop by
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShopSheilaJimenezMorejon
864 views13 slides
CICD Pipeline Using Github Actions by
CICD Pipeline Using Github ActionsCICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsKumar Shìvam
519 views21 slides
Introduction to Gitlab by
Introduction to GitlabIntroduction to Gitlab
Introduction to GitlabJulien Pivotto
20.7K views22 slides

More Related Content

What's hot

Your own full blown Gerrit plugin by
Your own full blown Gerrit pluginYour own full blown Gerrit plugin
Your own full blown Gerrit pluginDariusz Łuksza
2.5K views36 slides
Git Lab Introduction by
Git Lab IntroductionGit Lab Introduction
Git Lab IntroductionKrunal Doshi
847 views24 slides
Introducing GitLab by
Introducing GitLabIntroducing GitLab
Introducing GitLabTaisuke Inoue
1.1K views10 slides
Introduction to Github Actions by
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github ActionsKnoldus Inc.
493 views13 slides
Gerrit Code Review: how to script a plugin with Scala and Groovy by
Gerrit Code Review: how to script a plugin with Scala and GroovyGerrit Code Review: how to script a plugin with Scala and Groovy
Gerrit Code Review: how to script a plugin with Scala and GroovyLuca Milanesio
3.5K views34 slides
Git in 10 minutes by
Git in 10 minutesGit in 10 minutes
Git in 10 minutesSafique Ahmed Faruque
1.6K views13 slides

What's hot(20)

Your own full blown Gerrit plugin by Dariusz Łuksza
Your own full blown Gerrit pluginYour own full blown Gerrit plugin
Your own full blown Gerrit plugin
Dariusz Łuksza2.5K views
Git Lab Introduction by Krunal Doshi
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi847 views
Introduction to Github Actions by Knoldus Inc.
Introduction to Github ActionsIntroduction to Github Actions
Introduction to Github Actions
Knoldus Inc.493 views
Gerrit Code Review: how to script a plugin with Scala and Groovy by Luca Milanesio
Gerrit Code Review: how to script a plugin with Scala and GroovyGerrit Code Review: how to script a plugin with Scala and Groovy
Gerrit Code Review: how to script a plugin with Scala and Groovy
Luca Milanesio3.5K views
GitHub Actions in action by Oleksii Holub
GitHub Actions in actionGitHub Actions in action
GitHub Actions in action
Oleksii Holub431 views
What's New for GitLab CI/CD February 2020 by Noa Harel
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020
Noa Harel637 views
Git - An Introduction by Behzad Altaf
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf551 views
DevOps with GitHub Actions by Nilesh Gule
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps with GitHub Actions
Nilesh Gule374 views
Intro to Github Actions @likecoin by William Chong
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
William Chong204 views
Introduction to Git and GitHub by Vikram SV
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV207 views
Workshop on Git and GitHub by DSCVSSUT
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT259 views
Introduction to GitHub Actions by Knoldus Inc.
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
Knoldus Inc.3.2K views

Similar to Gerrit Code Review with GitHub plugin

GerritHub.io - present, past, future by
GerritHub.io - present, past, futureGerritHub.io - present, past, future
GerritHub.io - present, past, futureLuca Milanesio
8.2K views37 slides
Github by
GithubGithub
GithubJayesh Katta Ramalingaiah
259 views35 slides
Github security bug bounty hunting by
Github security   bug bounty huntingGithub security   bug bounty hunting
Github security bug bounty huntingvinoth kumar
1.9K views18 slides
Open up your platform with Open Source and GitHub by
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubScott Graham
1.3K views21 slides
Git single branch by
Git single branchGit single branch
Git single branchCarl Brown
1.3K views49 slides
Giddy Up on GitHub by
Giddy Up on GitHubGiddy Up on GitHub
Giddy Up on GitHubRocket Software
234 views30 slides

Similar to Gerrit Code Review with GitHub plugin(20)

GerritHub.io - present, past, future by Luca Milanesio
GerritHub.io - present, past, futureGerritHub.io - present, past, future
GerritHub.io - present, past, future
Luca Milanesio8.2K views
Github security bug bounty hunting by vinoth kumar
Github security   bug bounty huntingGithub security   bug bounty hunting
Github security bug bounty hunting
vinoth kumar1.9K views
Open up your platform with Open Source and GitHub by Scott Graham
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHub
Scott Graham1.3K views
Git single branch by Carl Brown
Git single branchGit single branch
Git single branch
Carl Brown1.3K views
Difference between Github vs Gitlab vs Bitbucket by jeetendra mandal
Difference between Github vs Gitlab vs BitbucketDifference between Github vs Gitlab vs Bitbucket
Difference between Github vs Gitlab vs Bitbucket
jeetendra mandal359 views
Getting started With GIT by GhadiAlGhosh
Getting started With GITGetting started With GIT
Getting started With GIT
GhadiAlGhosh132 views
Git interview questions | Edureka by Edureka!
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
Edureka!331 views
What's new in Gerrit Code Review v3.1 and beyond by Luca Milanesio
What's new in Gerrit Code Review v3.1 and beyondWhat's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyond
Luca Milanesio231 views
introductiontogitandgithub-120702044048-phpapp01.pdf by BruceLee275640
introductiontogitandgithub-120702044048-phpapp01.pdfintroductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee2756407 views
Github Case Study By Amil Ali by AmilAli1
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
AmilAli1481 views
Intro to Git, GitHub, and Devpost by Andrew Kerr
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and Devpost
Andrew Kerr662 views
Introduction to git and Github by Wycliff1
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1126 views
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar) by Mark Hamstra
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Mark Hamstra1.7K views

More from Luca Milanesio

Gerrit Analytics applied to Android source code by
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeLuca Milanesio
242 views26 slides
Cloud-native Gerrit Code Review by
Cloud-native Gerrit Code ReviewCloud-native Gerrit Code Review
Cloud-native Gerrit Code ReviewLuca Milanesio
229 views24 slides
Gerrit Code Review migrations step-by-step by
Gerrit Code Review migrations step-by-stepGerrit Code Review migrations step-by-step
Gerrit Code Review migrations step-by-stepLuca Milanesio
312 views39 slides
Gerrit Code Review v3.2 and v3.3 by
Gerrit Code Review v3.2 and v3.3Gerrit Code Review v3.2 and v3.3
Gerrit Code Review v3.2 and v3.3Luca Milanesio
142 views25 slides
ChronicleMap non-blocking cache for Gerrit v3.3 by
ChronicleMap non-blocking cache for Gerrit v3.3ChronicleMap non-blocking cache for Gerrit v3.3
ChronicleMap non-blocking cache for Gerrit v3.3Luca Milanesio
85 views17 slides
Gerrit Code Review multi-site by
Gerrit Code Review multi-siteGerrit Code Review multi-site
Gerrit Code Review multi-siteLuca Milanesio
1.1K views16 slides

More from Luca Milanesio(20)

Gerrit Analytics applied to Android source code by Luca Milanesio
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source code
Luca Milanesio242 views
Cloud-native Gerrit Code Review by Luca Milanesio
Cloud-native Gerrit Code ReviewCloud-native Gerrit Code Review
Cloud-native Gerrit Code Review
Luca Milanesio229 views
Gerrit Code Review migrations step-by-step by Luca Milanesio
Gerrit Code Review migrations step-by-stepGerrit Code Review migrations step-by-step
Gerrit Code Review migrations step-by-step
Luca Milanesio312 views
Gerrit Code Review v3.2 and v3.3 by Luca Milanesio
Gerrit Code Review v3.2 and v3.3Gerrit Code Review v3.2 and v3.3
Gerrit Code Review v3.2 and v3.3
Luca Milanesio142 views
ChronicleMap non-blocking cache for Gerrit v3.3 by Luca Milanesio
ChronicleMap non-blocking cache for Gerrit v3.3ChronicleMap non-blocking cache for Gerrit v3.3
ChronicleMap non-blocking cache for Gerrit v3.3
Luca Milanesio85 views
Gerrit Code Review multi-site by Luca Milanesio
Gerrit Code Review multi-siteGerrit Code Review multi-site
Gerrit Code Review multi-site
Luca Milanesio1.1K views
What's new in Gerrit Code Review 3.0 by Luca Milanesio
What's new in Gerrit Code Review 3.0What's new in Gerrit Code Review 3.0
What's new in Gerrit Code Review 3.0
Luca Milanesio1.1K views
Gerrit User Summit 2019 Keynote by Luca Milanesio
Gerrit User Summit 2019 KeynoteGerrit User Summit 2019 Keynote
Gerrit User Summit 2019 Keynote
Luca Milanesio296 views
Gerrit multi-master / multi-site at GerritHub by Luca Milanesio
Gerrit multi-master / multi-site at GerritHubGerrit multi-master / multi-site at GerritHub
Gerrit multi-master / multi-site at GerritHub
Luca Milanesio908 views
GerritHub a true Gerrit migration story to v2.15 by Luca Milanesio
GerritHub a true Gerrit migration story to v2.15GerritHub a true Gerrit migration story to v2.15
GerritHub a true Gerrit migration story to v2.15
Luca Milanesio438 views
Gerrit User Summit 2018 - Keynote by Luca Milanesio
Gerrit User Summit 2018 - Keynote Gerrit User Summit 2018 - Keynote
Gerrit User Summit 2018 - Keynote
Luca Milanesio588 views
Jenkins plugin for Gerrit Code Review pipelines by Luca Milanesio
Jenkins plugin for Gerrit Code Review pipelinesJenkins plugin for Gerrit Code Review pipelines
Jenkins plugin for Gerrit Code Review pipelines
Luca Milanesio1K views
Gerrit User Summit 2017 Keynote by Luca Milanesio
Gerrit User Summit 2017 KeynoteGerrit User Summit 2017 Keynote
Gerrit User Summit 2017 Keynote
Luca Milanesio495 views
How to keep Jenkins logs forever without performance issues by Luca Milanesio
How to keep Jenkins logs forever without performance issuesHow to keep Jenkins logs forever without performance issues
How to keep Jenkins logs forever without performance issues
Luca Milanesio1.1K views
Jenkins Pipeline on your Local Box to Reduce Cycle Time by Luca Milanesio
Jenkins Pipeline on your Local Box to Reduce Cycle TimeJenkins Pipeline on your Local Box to Reduce Cycle Time
Jenkins Pipeline on your Local Box to Reduce Cycle Time
Luca Milanesio498 views
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review by Luca Milanesio
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code ReviewJenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
Jenkins world 2017 - Data-Driven CI Pipeline with Gerrit Code Review
Luca Milanesio1.1K views
Stable master workflow with Gerrit Code Review by Luca Milanesio
Stable master workflow with Gerrit Code ReviewStable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code Review
Luca Milanesio1.9K views
Gerrit Code Review Analytics by Luca Milanesio
Gerrit Code Review AnalyticsGerrit Code Review Analytics
Gerrit Code Review Analytics
Luca Milanesio3.9K views
Zero-Downtime Gerrit Code Review Upgrade by Luca Milanesio
Zero-Downtime Gerrit Code Review UpgradeZero-Downtime Gerrit Code Review Upgrade
Zero-Downtime Gerrit Code Review Upgrade
Luca Milanesio3.4K views
Speed up Continuous Delivery with BigData Analytics by Luca Milanesio
Speed up Continuous Delivery with BigData AnalyticsSpeed up Continuous Delivery with BigData Analytics
Speed up Continuous Delivery with BigData Analytics
Luca Milanesio1.1K views

Recently uploaded

Narration lesson plan by
Narration lesson planNarration lesson plan
Narration lesson planTARIQ KHAN
69 views11 slides
Berry country.pdf by
Berry country.pdfBerry country.pdf
Berry country.pdfMariaKenney3
61 views12 slides
Gross Anatomy of the Liver by
Gross Anatomy of the LiverGross Anatomy of the Liver
Gross Anatomy of the Liverobaje godwin sunday
74 views12 slides
JRN 362 - Lecture Twenty-Three (Epilogue) by
JRN 362 - Lecture Twenty-Three (Epilogue)JRN 362 - Lecture Twenty-Three (Epilogue)
JRN 362 - Lecture Twenty-Three (Epilogue)Rich Hanley
41 views57 slides
Retail Store Scavenger Hunt.pptx by
Retail Store Scavenger Hunt.pptxRetail Store Scavenger Hunt.pptx
Retail Store Scavenger Hunt.pptxjmurphy154
52 views10 slides
Create a Structure in VBNet.pptx by
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptxBreach_P
82 views8 slides

Recently uploaded(20)

Narration lesson plan by TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN69 views
JRN 362 - Lecture Twenty-Three (Epilogue) by Rich Hanley
JRN 362 - Lecture Twenty-Three (Epilogue)JRN 362 - Lecture Twenty-Three (Epilogue)
JRN 362 - Lecture Twenty-Three (Epilogue)
Rich Hanley41 views
Retail Store Scavenger Hunt.pptx by jmurphy154
Retail Store Scavenger Hunt.pptxRetail Store Scavenger Hunt.pptx
Retail Store Scavenger Hunt.pptx
jmurphy15452 views
Create a Structure in VBNet.pptx by Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P82 views
Pharmaceutical Analysis PPT (BP 102T) by yakshpharmacy009
Pharmaceutical Analysis PPT (BP 102T) Pharmaceutical Analysis PPT (BP 102T)
Pharmaceutical Analysis PPT (BP 102T)
yakshpharmacy009101 views
Education of marginalized and socially disadvantages segments.pptx by GarimaBhati5
Education of marginalized and socially disadvantages segments.pptxEducation of marginalized and socially disadvantages segments.pptx
Education of marginalized and socially disadvantages segments.pptx
GarimaBhati540 views
JQUERY.pdf by ArthyR3
JQUERY.pdfJQUERY.pdf
JQUERY.pdf
ArthyR3103 views
Parts of Speech (1).pptx by mhkpreet001
Parts of Speech (1).pptxParts of Speech (1).pptx
Parts of Speech (1).pptx
mhkpreet00143 views
Class 9 lesson plans by TARIQ KHAN
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plans
TARIQ KHAN68 views
Monthly Information Session for MV Asterix (November) by Esquimalt MFRC
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)
Esquimalt MFRC98 views
The Accursed House by Émile Gaboriau by DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta246 views

Gerrit Code Review with GitHub plugin

  • 1. Luca@gerritforge.com http://www.gerritforge.com Twitter: @gitenterprise GitHub plugin for … Luca Milanesio GerritForge gerritGerrit Code Review Platinum Sponsor
  • 2. 2 .io About Luca • Luca Milanesio Co-founder of GerritForge • over 20 years of experience in Agile Development SCM and ALM worldwide • Contributor to Jenkins since 2007 (and previously Hudson) • Git SCM mentor for the Enterprise since 2009 • Contributor to Gerrit Code Review community since 2011
  • 3. 3 .io About GerritForge Founded in 2009 in London UK Mission: Agile Enterprise Products:
  • 4. 4 .io Agenda  Fork+Pull request or Change review ?  People says …  My experience say …  Plugging two worlds together  echo "github" | sed -e "s/git/gerrit/"  Pull requests and Repo replication  What do YOU think ?
  • 5. 5 .io Two divided review worlds BRANCH + PULL REQUEST CHECKOUT + AMEND
  • 6. 6 .io Fork + Pull request GitHub BitBucket GitLab Gitorious + others … > 10M repositories > 4M users SourceRepo mastera1c 2df f9a fork masterdec 6fa 7a1
  • 7. 7 .io Change review (rebase example) Gerrit GitBlit + others? SourceRepo mastera1c 2df 7a1 dec 6fa 7a1 changes/27/1627/* amend amend
  • 8. 8 .io Two worlds at a glance 1. BRANCH 2. SCORE THE BRANCH 3. MERGE ALL COMMITs in BRANCH 1. CHECKOUT 2. SCORE THE COMMIT 3. MERGE ONLY the REVIEWED COMMIT
  • 10. 10 .io There are two fundamental problems with single- patch review systems: 1. They encourage lumping at-best-weakly-related changes together. 2. They encourage you to hide your history. [http://bit.ly/1hhQkcA] The pull-request system looks like an incredible easy way to contribute to any project hosted on Github [but] doing any proper and useful contribution to a software is never done right the first time. But as a software maintainer you'll end up with pull-request you'll never get finished unless you wrap things up yourself. [http://bit.ly/1o7HIb6] A big advantage in Github's favor is the number of developers that are familiar with it compared to Gerrit. Gerrit can be popular with Git power-users, but friction-free use of it requires intermediate or advanced git knowledge, and tolerance of a steep learning curve. [http://bit.ly/1cJV8IJ] I have no problem with people using github as a hosting site, but in order for *me* to pull from github, you need to (a) make a real pull request […]: real explanation, proper email addresses, proper shortlog, and proper diffstat. (b) since github identities are random, I expect the pull request to be a signed tag [http://bit.ly/1iONQ4L]
  • 11. 11 .io MY OWN (OpenSource + Enterprise) [humble] EXPERIENCE …
  • 12. 12 .io Review model DO NOT make git bisect + git cherry-pick useless DO NOT throw commits over the fence (e.g. “I’ve made the pull request, now it’s up to you”)
  • 13. 13 .io Governance DEFINE rules for your project TRUST your identities and roles
  • 14. 14 .io Social engagement MAKE your project visible MAKE collaboration easy and fun
  • 15. 15 .io Growth PLAN for collaboration model to scale AVOID explosion of forks and pending pull-requests
  • 16. 16 .io Can we take both worlds ? + = ?
  • 17. 17 .io GitHub plugin for Gerrit Code Review https://gerrit-review.googlesource.com/#/admin/projects/plugins/github 1. Imports Pull Requests  Gerrit Changes / Topics 2. Reuses GitHub identity using Gerrit auth rules 3. Replication: keeps presence on http://github.com 4. Prevents explosion of unmanaged forks 5. Avoid GitHub spamming  one-email-per-change
  • 18. 18 .io Gerrit and GitHub? Who is ever gonna use it? June 2014 Statistics select count(*) from accounts = 1664 users select count(*) from changes = 3654 changes select count(*) from patch_sets = 4720 patch-sets find . -name '*.git' | wc –l = 5022 repositories du -s -h git = 140 GBytes
  • 19. 19 .io THIS IS COOL ! How can use it ?
  • 22. 22 .io HACKY WAY Build the plugin from source
  • 23. 23 .io Step#1 - GitHub OAuth 2.0 application keys https://github.com/settings/applications/new Your server URL (hostname / port Gerrit will listen to) OAuth 2.0 callback URL is Your server URL + /oauth
  • 24. 24 .io Step#2 – Get OAuth Client-Id / CLient-Secret GitHub OAuth 2.0 credentials for Gerrit integration
  • 25. 25 .io Step#3 – Download Gerrit 2.10 (master) http://ci.gerritforge.com/job/Gerrit-master
  • 26. 26 .io Step#4 – build GitHub plugin  git clone https://gerrit.googlesource.com/plugins/github && cd github  mvn install […] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.755s [INFO] Finished at: Sat Mar 15 19:16:23 GMT 2014 [INFO] Final Memory: 57M/449M [INFO] ------------------------------------------------------------------------
  • 27. 27 .io Step#5 – install OAuth filter and GitHub plugin > export GERRIT_SITE=/var/gerrit > mkdir –p $GERRIT_SITE/lib > cp github-oauth/target/github-oauth*.jar $GERRIT_SITE/lib > mkdir –p $GERRIT_SITE/plugins > cp github-plugin/target/github-plugin*.jar $GERRIT_SITE/plugins
  • 28. 28 .io Step#6 – Gerrit setup + replication + singleusergroup > cd $GERRIT_SITE && java –jar release.war init –d $GERRIT_SITE *** Gerrit Code Review 2.9-rc1-779-g90fac34-dirty *** […] *** User Authentication *** Authentication method ? HTTP Get username from custom HTTP header ? Y Username HTTP header ? GITHUB_USER *** Plugins *** Install plugin singleusergroup version v2.9-rc2-536-g79393b2 [y/N]? y Install plugin replication version v2.9-rc2-536-g79393b2 [y/N]? y
  • 29. 29 .io Step#7 – Configure GitHub integration […] *** GitHub Integration *** GitHub URL ? https://github.com Use GitHub for Gerrit login ? Y ClientId ? 732819a7b9c9d9a98 ClientSecret ? 6271627a6a7s6s718173642718a9bcacd HTTP Authentication Header [GITHUB_USER]:
  • 31. Replay presentation: http://slideshare.net/lucamilanesio Sign-in: http://gerrithub.io/login Gerrit book: http://gerrithub.io/book Learn more about 20% OFF Book discount for 33 Degree.org User Conference Book CODE: dg7jnZ eBook CODE: Wi86Zh