Workflow with Gerrit

278 Views Asked by At

We have been thinking of go over from using Git only to Gerrit review environment, since we would like to enable code reviews and running automatic unit tests among others.

We would also like go for Git flow workflow (since people are pretty used to it) (https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow)

Now, I would like to know if our first approach will work in real life.

We have setup the following access controls:

[access "refs/*"]
        owner = group MyProject Admin
        owner = group MyProject Project Owner
[access "refs/for/refs/heads/*"]
        push = group MyProject Contributor
        push = group MyProject Developer
        push = group MyProject Integrator
        push = group MyProject Project Owner
        pushMerge = group MyProject Developer
        pushMerge = group MyProject Integrator
        pushMerge = group MyProject Project Owner
        forgeCommitter = group MyProject Integrator
        forgeCommitter = group MyProject Project Owner
[access "refs/tags/*"]
        read = group MyProject CI System
        read = group MyProject Contributor
        read = group MyProject Developer
        read = group MyProject Project Owner
        pushTag = group MyProject Integrator
        pushTag = group MyProject Project Owner
[access "refs/heads/feature/*"]
        read = group MyProject Contributor
        read = group MyProject Developer
        read = group MyProject Integrator
        read = group MyProject Project Owner
        create = group MyProject Contributor
        create = group MyProject Developer
        create = group MyProject Integrator
        create = group MyProject Project Owner
        forgeAuthor = group MyProject Contributor
        forgeAuthor = group MyProject Developer
        forgeAuthor = group MyProject Integrator
        forgeAuthor = group MyProject Project Owner
        push = group MyProject Contributor
        push = group MyProject Developer
        push = group MyProject Integrator
        push = group MyProject Project Owner
        pushMerge = group MyProject Contributor
        pushMerge = group MyProject Developer
        pushMerge = group MyProject Integrator
        pushMerge = group MyProject Project Owner
        rebase = group MyProject Contributor
[access "refs/heads/*"]
        read = group MyProject CI System
        read = group MyProject Contributor
        read = group MyProject Developer
        read = group MyProject Integrator
        read = group MyProject Project Owner
        create = group MyProject Integrator
        forgeAuthor = group MyProject Developer
        forgeAuthor = group MyProject Integrator
        forgeAuthor = group MyProject Project Owner
        push = group MyProject Integrator
        push = +force group MyProject Project Owner
        pushMerge = group MyProject Integrator
        pushMerge = group MyProject Project Owner
        label-Code-Review = -2..+2 group MyProject Developer
        label-Code-Review = -2..+2 group MyProject Integrator
        label-Code-Review = -2..+2 group MyProject Project Owner
        label-Code-Review = -1..+1 group MyProject Contributor
        label-Code-Review = -1..+0 group MyProject CI System
        label-Verified = -1..+1 group MyProject Developer
        label-Verified = -1..+1 group MyProject Integrator
        label-Verified = -1..+1 group MyProject Project Owner
        label-Verified = +0..+1 group MyProject CI System
        submit = group MyProject Developer
        submit = group MyProject Integrator
        submit = group MyProject Project Owner

Hence, all features will be under refs/heads/feature/* . The plan is to start from develop branch, create a feature from it and work on that feature.

git checkout -b feature/new-feature-xy develop

During the work on the feature branch, several new commits will be performed. To enable collaboration with other team members (multiple members may work on the same feature), the user will push and pull the feature branch.

<do changes> # Do some work
$ git add <files> # Add files for revision (git add --all for add all files) 
$ git commit –m ‘<Commit message>’ # or ammend if you like
$ git pull # Merge new commits from other users
$ git pull origin/develop # Merge from develop
$ git push # Push the feature for other team members

When the feature on branch feaure/new-feature-xy is declared finished we squash all commits and merge it to the develop branch. Add it for review.

$ git checkout develop # Change branch to develop
$ git pull # Update develop
$ git merge --squash feature/new-feature-xy #Squash all commits in feature branch, merge it
$ git push origin HEAD:refs/for/develop # Push for review

Is this an acceptable Gerrit workflow, or do you think we will get problems in the future using this way?

0

There are 0 best solutions below