Limiting concurrent builds for branch

Problem to solve

Consider CI with auto-deployment step. Such situation actually happens in our environment:

  1. commit 1 is merged to master and starts pipeline 1.
  2. commit 2 is merged to master and starts pipeline 2.
  3. pipeline 2 runs faster than pipeline 1, so commit 1 (older) is deployed after commit 2 (newer)
  4. all changes from commit 2 are basically lost until next deployment.

That is clear deployment race-condition. Moreover it's not really easy to notice it. Similar problem explained in https://gitlab.com/gitlab-org/gitlab-ce/issues/26669.

Proposal

Add configuration option to limit concurrent builds for specific branch.

For example, branch master can be limited to single build at a time.
So pipeline 2 would not even start unless pipeline 1 is fully completed.

Links / references

Edited Jan 09, 2019 by Anton Sibilev
Assignee Loading
Time tracking Loading