Shopify / shipit-engine

Deployment coordination
https://shopify.engineering/introducing-shipit
MIT License
1.41k stars 145 forks source link

Identical Stacks can interfere with each other's Merge Queue #1121

Open eldad87 opened 3 years ago

eldad87 commented 3 years ago

Currently, I'm able to create 2 stacks for the same repo & branch. If Merge-Queue is enabled on both, they can interfere with each other.

Suggestion: Merge-Queue can be enabled only once for a given set of Repo & Branch, regardless of the stack environment.

module Shipit
  class Stack < Record
    module NoDeployedCommit

...

    validates :merge_queue_enabled, uniqueness: {
        scope: %i(repository branch),
        message: 'cannot be used more than once with this repository and branch. Check (archived) stacks.'
    }

...
eldadvcita commented 3 years ago

For backward compatibility, I can add a flag that indicates if this validation should be enforced. The flag can be added to the repository module: "Single CI per branch".