Gerrit Change Workflows

David Ostrovsky

Gerrit User Conference

Palo Alto, 2018

Outline

Standard Gerrit change workflow / 1

Pre-Submit code review workflow

  $ git push origin HEAD:refs/for/master

./imgs/change_workflow_pre_submit.png

Standard Gerrit change workflow / 2

Post-Submit code review workflow (supported since 2.14)

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

./imgs/change_workflow_post_submit.png

Custom change workflow / 1

./imgs/change_workflow_custom.png

Custom change workflow / 2

Custom change workflow / 3

Draft change workflow / 1

  $ git push origin HEAD:refs/drafts/master

./imgs/draft_change_workflow.png

Draft change workflow / 2

Draft change workflow / 3

./imgs/draft_change_workflow_draft_abandoned.png

Draft patch set workflow

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

./imgs/draft_patch_set_workflow.png

Disadvantages of draft change workflow

Work In Progress (WIP) workflow from OpenStack project

./imgs/work_in_progress_workflow.png

Combined WIP workflow with DRAFT workflow

./imgs/draft_and_work_in_progress_workflow.png

Allow to disable draft workflow in Gerrit core

WIP plugin: abuse DRAFT change state

./imgs/work_in_progress_workflow_as_wip_plugin.png

WIP Plugin: Show regular change

./imgs/changes_are_shown.png

WIP Plugin: Flip WIP bit on a change

./imgs/mark_as_wip.png

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

./imgs/filtered_wip_changes.png

WIP Plugin: Flip ready bit on a change

./imgs/mark_as_ready.png

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

./imgs/work_in_progress_workflow_in_core.png

WIP workflow: Mark as work in progress - button

./imgs/mark_as_wip_button.png

WIP workflow: Start Review - button

./imgs/start_review_button.png

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

./imgs/start_review_save_button.png

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

./imgs/new_change_as_wip_per_default.png

WIP workflow: Always push as WIP per project setting

[change]
        workInProgressByDefault = true

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

Releasing WIP workflow

Discontinue Draft change workflow

Private change workflow

./imgs/work_in_progress_workflow_and_private_change_workflow_in_core.png

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
   > 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