arex1337
arex1337

Reputation: 216

Workflow that enforces code review and keeps the integration branch pristine (git, Stash, TeamCity)

I'm trying to design a new workflow that follows these principles:

We are using git, Stash and TeamCity. This is what I have come up with, but none of them are perfect. I'm looking for tweaks to my suggestions, or new ideas.

WORKFLOW 1

WORKFLOW 2

WORKFLOW 3

WORKFLOW 4

Upvotes: 6

Views: 2627

Answers (2)

Biswajit_86
Biswajit_86

Reputation: 3739

I would recommend Workflow 4 but with slight modifications

  • Run CI on all feature branches whenever there is a check-in . Report the results to Stash using teamcity-stash plugin

  • Enable Stash to do automatic merge whenever there is at least

    • x number of approvers
    • and y number of successful builds.
  • Whenever a developer is ready , they can create pull request into mainline
  • Run CI on all pull requests and report this status to teamcity . The advantage here is that whenever a pull request is approved git automatically merges that commit into other pull requests and hence re-triggers CI on all pull requests
  • Once the reviewers and approvers approve the code and the pull requests have passed CI succesfully , stash automatically merges the pull request
  • Run your build and test on every check-in into the integration branch so that you can pinpoint which check-in started failing any specific tests(if you have any tolerance limit for tests)

Upvotes: 0

charleso
charleso

Reputation: 1836

ex-Stash developer here. Just some general thoughts.

The Stash team (and most teams I've worked with and observed) do "optimistic" branch builds. That is they build the source branch under the assumption/hope that if it merges cleanly it probably won't break the mainline build. And in my experience this is almost always the case.

Some options:

  1. Do nothing - if/when mainline does eventually break fix it quickly
  2. Do nothing but auto-revert any merge commit that produces a red build (and possibly do it manually to start with)
  3. Require that PR merges are fast-forward only, and developers need to manually rebase/merge from mainline before merging back
  4. Add a custom gatekeeper plugin/button into Stash to all you to "Merge on green build after integration" which does a one-time merge build first before doing the actual merge.

I agree that in general building from Stash's hidden 'merge' ref, depending on how long your pull requests are open, is probably going to result in too many builds (as you pointed out).

Not sure if that helps?

Upvotes: 3

Related Questions