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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple server-side repo config: pre_workflow_hooks not overridden #4572

Open
MrLuje opened this issue May 17, 2024 · 0 comments
Open

Multiple server-side repo config: pre_workflow_hooks not overridden #4572

MrLuje opened this issue May 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MrLuje
Copy link

MrLuje commented May 17, 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.

Overview of the Issue

I defined the following server-side repo config

  repoConfig: |
    ---
    repos:
    - id: /.*/
      pre_workflow_hooks:
      - run: echo 'running default flow...'
      apply_requirements: [approved, mergeable, undiverged]
      allowed_overrides: [workflow]
      allow_custom_workflows: true

    - id: /.*rancher/
      pre_workflow_hooks:
      - run: echo 'running rancher flow'

Based on documentation, I expect the first pre_workflow_hooks key to be overridden by the /.*rancher/ config

image

Reproduction Steps

  • with configuration defined as previously
  • create a merge request in a repo that matches the rancher rule

Expected: only the pre_workflow_hooks from rancher should be executed
Actual: both pre_workflow_hooks are executed

Logs

Logs
{"level":"info","ts":"2024-05-17T10:15:45.850Z","caller":"events/working_dir.go:239","msg":"creating dir \"/atlantis-data/repos/rancher/10/default\"","json":{}}
{"level":"info","ts":"2024-05-17T10:15:48.081Z","caller":"runtime/pre_workflow_hook_runner.go:80","msg":"successfully ran \"sh -c echo 'running default flow...'\" in \"/atlantis-data/repos/rancher/10/default\"","json":{"repo":"rancher","pull":"10"}}
{"level":"info","ts":"2024-05-17T10:15:57.153Z","caller":"runtime/pre_workflow_hook_runner.go:80","msg":"successfully ran \"sh -c echo 'running rancher flow'\" in \"/atlantis-data/repos/rancher/10/default\"","json":{"repo":"rancher","pull":"10"}}
{"level":"info","ts":"2024-05-17T10:16:01.847Z","caller":"events/project_command_builder.go:427","msg":"successfully parsed atlantis.yaml file","json":{"repo":"rancher","pull":"10"}}
{"level":"info","ts":"2024-05-17T10:16:01.847Z","caller":"events/project_command_builder.go:467","msg":"1 projects are to be planned based on their when_modified config","json":{"repo":"rancher","pull":"10"}}

Environment details

Additional Context

I also find the wording of the documentation a bit weird

If multiple repos match, the last match will apply. -> I first though that only the last config will be used

If a key isn't defined, it won't override a key that matched from above. For example, given a repo ID github.com/owner/repo and a config -> but in fact, all matching repos will be used, merged and the last value of each key is used

@MrLuje MrLuje added the bug Something isn't working label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant