Bringing Pull Request to Gerrit

23
Copyright ©2015 CollabNet, Inc. All Rights Reserved. Gerrit User Summit 2016 Bringing Pull Request to Gerrit A tale of feature development Eryk Szymanski Potsdam Engineering Office CollabNet

Transcript of Bringing Pull Request to Gerrit

Page 1: Bringing Pull Request to Gerrit

Copyright ©2015 CollabNet, Inc. All Rights Reserved.

Gerrit User Summit 2016

Bringing Pull Request to GerritA tale of feature development

Eryk Szymanski

Potsdam Engineering OfficeCollabNet

Page 2: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

CollabNet Facts

10,000+ customers, proven in global deployments as large as 80,000 users and 1 billion commits

Leader in open-source based application lifecycle management, version control, DevOps, and collaboration solutions

250 employees across the globe

Founded in 1999; HQ in South San Francisco, CA

2

Page 3: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

CollabNet Customers

Financials

Technology

Government

Other

Service Providers

3

Page 4: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

CollabNet TeamForge - ALM Solution

4

Page 5: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

TeamForge - Git/Gerrit Integration

5

Our approach:

• Support Open Source

– Give back to the community

• If it is Gerrit core change, open source it

– Do not fork

• Stay as close to current Gerrit as possible

– It is ok to have patches on top of vanilla Gerrit

– But those are regularly rebased as Gerrit progresses

• Everything else goes into the plugins

Based on Gerrit 2.13.2 + some patches

and 6 proprietary plugins

Page 6: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Git/Gerrit Integration - Features

6

History ProtectionUsers & RBAC

Quality GatesReplication

Git LFS Support

Pull Request

Notifications

Page 7: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request Workflow

7

yes

no

Page 8: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request from Gerrit User Perspective

8

What is a Pull Request?

– It is a merge commit pushed for review.

Does it mean it is possible to have a pull request in Gerrit?

– Yes, one can have a merge commit pushed for review.

But can I see a full diff to review the changes?

– Yes, it is possible since this patch got merged:

http://gerrit-review.googlesource.com/#/c/72092/

So what’s the big deal?

– No User Interface. Pull Request model is quite different

than Gerrit model and Gerrit UI does not support it.

Page 9: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

From Pull Request User Perspective

9

Will my branch appear in UI once I push it to remote?

– Yes, you can see it in Gerrit.

So where is my create pull request button?

– There isn’t any.

Oh, I thought you said there is a Pull Request feature in Gerrit.

Although technically speaking it is possible to use the Pull Requests, from a user perspective there is still no such a feature in Gerrit

Page 10: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Motivation behind Pull Request

10

• Pull Requests are popular

– Our customers ask for it

• General familiarity with the Pull Request model

– Easier onboarding for new TeamForge users

• Support feature branch development model

– Final big-bang review before merge

– One can even combine that with Gerrit model having both

Our goal was to deliver an intuitive Pull Request UI to enable easy onboarding for people who are already familiar with Pull Request and do not know Gerrit

Page 11: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Implementation - User Interface Findings

•Gerrit UI is very powerful but hard to use for a novice

•Adding a new feature might not make it easier

• It is hard to maintain UI changes that are not upstream

•Working on UI with the community may slow us down

and does not give us full control over the UI

•The user experience degrades every time one have to switch between different applications

•Not sure what to choose: GWT or PolyGerrit (at that point of time)

11

Page 12: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Implementation - User Interface Solution

• Seamless UI and Consistent flow for TeamForge Users

• One can use Pull Request or other Gerrit features without even seeing Gerrit

• Everything happens in one place - TeamForge Code Browser

12

Implement the UI in TeamForge Code Browser

Page 13: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Implementation - REST API

• Gerrit Rest API:

– While it is doing great job for Gerrit, it is not always optimal in delivering required data for our UI (i.e. Pull Request)

– Not versioned (and sometimes changes)

– No support for O-Auth authentication

• Solution:

– Come up with our own REST API

– It comes as a plugin and is specific for our needs

– Versioned and uses O-Auth for authentication

13

Page 14: Bringing Pull Request to Gerrit

Copyright ©2015 CollabNet, Inc. All Rights Reserved.Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Demo

Pull Request in Action

Page 15: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Code Browser - Branches

15

Page 16: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Create Pull Request

16

Page 17: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request Created

17

Page 18: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request In Review

18

Page 19: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request Reviewed

19

Page 20: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request Updated - Owner View

20

Page 21: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request Updated - Reviewer View

21

Page 22: Bringing Pull Request to Gerrit

Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Pull Request Ready To Be Merged

22

Page 23: Bringing Pull Request to Gerrit

Copyright ©2015 CollabNet, Inc. All Rights Reserved.Copyright ©2016 CollabNet, Inc. All Rights Reserved.

Thank you very much

Any Questions?