Gerrit Change Workflows

David Ostrovsky

Gerrit User Conference

Palo Alto, 2018


Standard Gerrit change workflow / 1

Pre-Submit code review workflow

  $ git push origin HEAD:refs/for/master


Standard Gerrit change workflow / 2

Post-Submit code review workflow (supported since 2.14)

  $ git push origin sha1:refs/for/master%merged


Custom change workflow / 1


Custom change workflow / 2

Custom change workflow / 3

Draft change workflow / 1

  $ git push origin HEAD:refs/drafts/master


Draft change workflow / 2

Draft change workflow / 3


Draft patch set workflow

  $ git push origin HEAD:refs/for/master
  <amend the commit>
  $ git push origin HEAD:refs/drafts/master


Disadvantages of draft change workflow

Work In Progress (WIP) workflow from OpenStack project


Combined WIP workflow with DRAFT workflow


Allow to disable draft workflow in Gerrit core

WIP plugin: abuse DRAFT change state


WIP Plugin: Show regular change


WIP Plugin: Flip WIP bit on a change


WIP Plugin: WIP changes are filtered out on reviewer’s dashboards


WIP Plugin: Flip ready bit on a change


Disadvantages of WIP plugin

Alternative considered to WIP workflow (in core or as a plugin)

Gerrit adoption by Chromium project in mid 2017

Work In Progress workflow: Revisited

WIP workflow: Implementation


WIP workflow: Mark as work in progress - button


WIP workflow: Start Review - button


WIP workflow: Use "Save" button to publish comments without moving the change out of WIP


WIP workflow: ACL to flip the WIP state to ready

WIP workflow: Push options

  $ git push -o wip origin HEAD:refs/for/master
  $ git push origin HEAD:refs/for/master%wip

WIP workflow: Notification impact

WIP workflow: Dashboard

WIP workflow: Search

  if ("reviewer".equalsIgnoreCase(value)) {
    return Predicate.and(
        Predicate.not(new BooleanPredicate(ChangeField.WIP)),
        ReviewerPredicate.reviewer(args, self()));
  reviewer:self -is:wip

WIP workflow: Always push as WIP per user setting


WIP workflow: Always push as WIP per project setting

        workInProgressByDefault = true

WIP workflow: Always mark as WIP for changes created in browser

Releasing WIP workflow

Discontinue Draft change workflow

Private change workflow


Migration strategy from earlier Gerrit versions to 2.15 (Schema_159)

Migrating data to schema 158 ...
   > Done (0.000 s)
Migrating data to schema 159 ...
Migrate draft changes to private changes (default is work-in-progress) [y/N]?
Replace draft changes with work_in_progress changes ...
   > Done (7.917 s)

Caution with Draft changes migration to Private changes strategy

  owner:self is:private

Left over from removal of Draft change workflow

  git push origin HEAD:refs/drafts/master # 1
  <amend 1>
  git push origin HEAD:refs/drafts/master # 2
  <amend 2>
  git push origin HEAD:refs/drafts/master # 3

Thank you

David Ostrovsky

Mainatainer, Gerrit Code Review