Git and Gerrit Workflows. Enforcing Manual & Automated Review

Similar documents
Creating a Patch. Created by Carl Heymann on 2010 Sep 14 1

CS 390 Software Engineering Lecture 5 More Git

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

Git for Subversion users

Change-sets. Basavaraj Karadakal

Revision Control. An Introduction Using Git 1/15

Belle II - Git migration

a handful of Git workflows for the agilist steven harman twitter: stevenharman

Subversion Repository Layout

Continuous Deployment with Gerrit and Jenkins

Getting the Source Code

Topics covered. Introduction to Git Git workflows Git key concepts Hands on session Branching models. Git 2

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

Version Control: Gitting Started

Using Git For Development. Shantanu Pavgi, UAB IT Research Computing

Ingegneria del Software Corso di Laurea in Informatica per il Management (D)VCS. Davide Rossi Dipartimento di Informatica Università di Bologna

From Tiny Acorns Your first submission to OpenAFS. Simon Wilkinson

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Gerrit

Git. A Distributed Version Control System. Carlos García Campos

Visualizing Git Workflows. A visual guide to 539 workflows

Beyond git add/commit/push

Versioning with git. Moritz August Git/Bash/Python-Course for MPE. Moritz August Versioning with Git

ci-management Release 1.0.0

Software configuration management

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Version Control with Git ME 461 Fall 2018

Version Control System - Git. zswu

git the SCM system Jan-Simon Möller training.linuxfoundation.org

Using GitHub and SourceTree to work with DITA TC repositories

Mike McQuaid INCLUDES 66 TECHNIQUES. Foreword by Scott Chacon MANNING

EGit in Eclipse. Distributed Verzion Control Systems

Revision Control and GIT

CSC 2700: Scientific Computing

Index. Alias syntax, 31 Author and commit attributes, 334

Version Control with Git

Continuous Integration / Continuous Testing

Introduction to distributed version control with git

GIT TUTORIAL. Creative Software Architectures for Collaborative Projects CS 130 Donald J. Patterson

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

RSARTE Git Integration

Configuration Management

Version Control Systems

Version Control with GIT: an introduction

Fundamentals of Git 1

GUIDE TO MAKE A REAL CONTRIBUTION TO AN OPEN SOURCE PROJECT 1. 1

Revision Control. Software Engineering SS 2007

MOOSE-Based Application Development on GitLab

CS314 Software Engineering Configuration Management

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

Git Like You Mean it. Alan Ott SCaLE 16x March 8-11, 2018

CSE 331 Software Design & Implementation

A BASIC UNDERSTANDING OF VERSION CONTROL

Best Practices. Joaquim Rocha IT-DSS-TD

Software Development I

Git version control with Eclipse (EGit) Tutorial

Introduction to Git and Github

Version Control. So#ware Quality Quality Audit and Cer2fica2on. Master in Computer Engineering. Roberto García

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

Lecture 01 - Working with Linux Servers and Git

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

Lab 08. Command Line and Git

USER GUIDE. MADCAP FLARE 2017 r3. Source Control: Git

Who Moved My Module? 1

Welcome! Virtual tutorial will start at 15:00 GMT. Please leave feedback afterwards at:

Revision control Advanced git

Why? Clean Model Branches Local reflog Flows Doc Ex. Advanced use of Git. Matthieu Moy

OTC Tools Development and Release process. Igor Stoppa & Eduard Bartosh & JF Ding V May 2013

chatterbot-weather Documentation

FreeBSD and Git. Ed Maste - FreeBSD Vendor Summit 2018

What s New in Gerrit 2.14 Gerrit User Summit London 2017


Version Control. Version Control

February 2 nd Jean Parpaillon

Source Code Management wih git

projecto Documentation

INET

Tizen/Artik IoT Practice Part 4 Open Source Development

Contribute To Linux Mainline

How to become an Eclipse committer in 20 minutes and to fork the Eclipse IDE

TangeloHub Documentation

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

CLOSE ENCOUNTERS OF THE UPSTREAM RESOURCE

Project Management. Overview

E, F. deleteall command, 352 directory structure, 350 export_data method, 353 inline_data method, 353 print_export method, 351 target directory, 351

platform Development Process Optimization For Drupal centric projects

Git Basi, workflow e concetti avanzati (pt2)

Git Tutorial. André Sailer. ILD Technical Meeting April 24, 2017 CERN-EP-LCD. ILD Technical Meeting, Apr 24, 2017 A. Sailer: Git Tutorial 1/36

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

An introduction to git

Version Control System GIT

August 22, New Views on your History with git replace. Christian Couder

b. Developing multiple versions of a software project in parallel

Git for Newbies. ComMouse Dongyue Studio

Continuous translation with Weblate. Michal Čihař

Version Control Systems (Part 1)

contribution-guide.org Release

Version Control Systems: Overview

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

Django MFA Documentation

EGit and JGit 1.0 Release and Graduation Review

Transcription:

Git and Gerrit Workflows Enforcing Manual & Automated Review

Agenda Branching and Workflow Review A Look at Gerrit The Gerrit Workflow Other Workflows Customizing Gerrit Workflow

Branching and Workflow Basics

Branches represent divergence. They confuse developers. They add complexity.

So why make a branch?

Maintain related sets of work Isolate unstable or custom code trunk feature

rel-1.1 trunk Maintain related sets of work Work on older releases

Branches Have DuraDon trunk feature Promote and redre

More stable trunk rel-1.1 Less stable feature Branches Have Stability

Branches Have Flow of Change Merge down rel-1.1 trunk feature Promote up

custom rel patch trunk feature sandbox Simple to Complex

Workflow Guides the Flow of Change task branch trunk svn merge git merge

A Look at Gerrit

Origins Android ecosystem Vibrant community Mondrian! Perforce- centric Google internal Rietveld! Open source Subversion

Community User Conferences Hackathons Sponsors Contributors Qualcomm Motorola Google SAP SpoDfy Yahoo Nvidia Samsung

Key Features Repository Management Access Control Code Review

Key Features Repository Management Access Control Repo creadon HTTPS/SSH Code Review

Key Features Repository Management Access Control Hierarchical model Granular permissions LDAP & others Code Review

Gerrit Workflow

The Gerrit Model Unreviewed changes isolated CI built into workflow

Android Repo coordinates 300+ repos Isolates patch authors from commi\ers Otherwise not as bad as it looks

Key Principles All changes are reviewed Dynamic review branches Review IDs group serial work Human voting Enforce CI on every commit Build system gets a vote!

Steps Clone Push Review Submit Gerrit has unusual URLs Should clone change- id hook Use special review ref Can amend exisdng review +1 to like, +2 to approve Build result Merge through UI Commit to branch

Review Options Web UI CLI / API Download patch Voting rights based on access control +/- 1 +/- 2 Verify

Rework Check out original commit Each change has a unique ID All amendments preserved as patch sets Push again Amend commit with new work

Etiquette Even rejected changes are valuable Comments are often as important as the code Can enforce signed off by

This is weird Best to see it in action Find a demo station

Other Git Workflows

Fork and pull Fork Work Pull request

30 Topic branches Clone Make topic branch Work Push branch Merge request

31 Mainline model Work locally Push to trunk Push frequently

Git Flow Uses several long lived branches Master Develop Staging Feature and release branches and tags 32

Gerrit Similar to topic branches with very narrow topics Really represents mainline model with continuous review ConDnuous Review The speedy picking up of unreviewed pending commits - Paul Hammant Every commit is reviewed Within minute or hours of compledon Before it hits trunk Ties review to code

Mainline model is built for condnuous delivery In pardcular have a mainline: a single branch of the project currently under development. Pre\y much everyone should work off this mainline most of the Dme. (Reasonable branches are bug fixes of prior producdon releases and temporary experiments.) Mar8n Fowler Steps to Trunk git commit am task work git push origin HEAD:refs/for/master <review, build, and publish in Gerrit>

Customizing Gerrit Workflow

Submit Rules " Defines when a change can be submitted " Default One highest vote in each category No lowest votes in any category Both: Human +2! CI +1! But not: Human -2! Or CI -1!

Submit Types " Defines how a change can be submitted (per project) " Types Fast forward only Merge if necessary Merge always Cherry pick Rebase if

Custom Workflows " Prolog Logic programming language Often used in AI Bit of a learning curve " What s possible Project-specific submit rules Replace default submit rules Define when a commit is accepted Override project submit type

Prolog in Gerrit " Prolog-café fork embedded " Prolog-shell provided for testing " SWI-Prolog environment for debugging

Project-specific submit rules " Stored in rules.pl in refs/meta/config branch Modify via Git commits " Sequence Gerrit provides a set of facts about a change Author, committer, message, etc. Provided in gerrit package Then calls rules.pl Submit_rule predicate Return value indicates whether change is submittable

Global submit filters " Filters submit rules " Runs up parent project hierarchy " Mechanism for global admins to enforce rules across all projects

Custom submit type " Write a submit_type predicate " For any change indicate accepted submit type " Can include submit type filters

Testing submit rules " Test submit_rule against a real change in Gerrit " Use test-submit rule cat rules.pl! ssh gerrit_host gerrit test-submit rule <change id> -s!

Example: Authors cannot +2 submit_rule(s) :-! gerrit:default_submit(x),! X =.. [submit Ls],! add_non_author_approval(ls, R),! S =.. [submit R].!! add_non_author_approval(s1, S2) :-! gerrit:commit_author(a),! gerrit:commit_label(label('code-review', 2), R),! R \= A,!,! S2 = [label('non-author-code-review', ok(r)) S1].! add_non_author_approval(s1,! [label('non-author-code-review', need(_)) S1]).!

Example: Only fast forward on release branches submit_type(fast_forward_only) :-! gerrit:change_branch(b), regex_matches('refs/heads/! release.*', B),!!.! submit_type(t) :- gerrit:project_default_submit_type(t)!

Thank You @rdefauw