I’m trying to move my org into a more gitops workflow. I was thinking a good way to do promotions between environments would be to auto sync based on PR label.

Thinking about it though, because you can apply the same label multiple times to different PRs, I can see situations where there would be conflicts. Like a PR is labeled “qa” so that its promoted to the qa env, automated testing is started, a different change is ready, the PR is labeled “qa”, and it would sync overwriting the currently deployed version in qa. I obviously don’t want this.

Is there a way to enforce only single instances of a label on a PR across a repository? Or maybe there is some kind a queue system out there that I’m not aware of?

I’m using github, argocd, and circleci.

  • vvv
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    1 year ago

    I would recommend you avoid relying on features of GitHub, and only use features of git. You never know when you might decide to switch repo hosting providers!

    With that said, you’ve got a number of options: you can use tags or branches as “labels” to choose what’s applied to what environment, or depending on the flavor of IaC you’re using, have an entry point for each environment in your code which includes and parameterizes a common “environment” module.

    • thelastknowngod@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Branching per environment gets to be a nightmare really quickly. I am trying to avoid that.

      I am not worried about vendor lock in.

      • vvv
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I agree. What I’m proposing is, if you go with that option, that you use a branch as a “single instance label”, pointing at commits within your main branch. Don’t use them as actual branches for additional environment-specific commits.