Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor behaviour of matching repo ids and branches in the server-side config #4245

Open
1 task done
dimisjim opened this issue Feb 14, 2024 · 0 comments
Open
1 task done
Labels
feature New functionality/enhancement Stale

Comments

@dimisjim
Copy link
Contributor

dimisjim commented Feb 14, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Describe the user story

I would like to be able to have a different behaviour of matching repo keys mentioned in https://www.runatlantis.io/docs/server-side-repo-config.html#repo, most importantly to be able to define the same repo id multiple times, but with a different branch regex each time. This way I can define something like this:

- id: github.com/org/repo1
  branch: /^prod$/
  workflow: prod
  allowed_workflows: [prod]

  autodiscover:
    mode: auto

- id: github.com/org/repo1
  branch: /^qa$/
  workflow: qa
  allowed_workflows: [qa]

  autodiscover:
    mode: auto

- id: github.com/org/repo1
  branch: /^dev$/
  workflow: dev
  allowed_workflows: [dev]

  autodiscover:
    mode: auto

which would match the repo selector that contains the most matches. Thus if repo1 is matched, it will only match the dev branch, only if it is the last occurrence, as it is above, but if it was first or second in the list, it wouldn't match at all.

Describe the solution you'd like

For example, if repo is matches AND branch is matches, stop there, and do not pick a later repo occurrence as mentioned in the doc link above: "If multiple repos match, the last match will apply."

Describe the drawbacks of your solution

This is a completely different behaviour than the one currently in place. Maybe an extra flag which allows you to pick the current one or the one proposed here would be nice, or actually essential, to have.

Describe alternatives you've considered

Do this configuration in the repo level config, by defining multiple projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement Stale
Projects
None yet
Development

No branches or pull requests

1 participant