Skip to content

fix: Respect server side config for autodiscover#5849

Merged
lukemassa merged 9 commits intorunatlantis:mainfrom
lukemassa:respect_server_side_config_for_autodiscover
Oct 1, 2025
Merged

fix: Respect server side config for autodiscover#5849
lukemassa merged 9 commits intorunatlantis:mainfrom
lukemassa:respect_server_side_config_for_autodiscover

Conversation

@lukemassa
Copy link
Contributor

@lukemassa lukemassa commented Sep 30, 2025

what

Respect server side config for autodiscover

why

This was a bug in the original implementation #5267 pointed out in #5772. We were only respecting AutoDiscover settings when set in the repoCfg (i.e., per repo atlantis.yaml), not in the globalCfg (i.e., server side config).

tests

I added some new unit tests, one of which would fail on main, which demonstrates the issue.

atlantis % git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
atlantis % go test ./server/events -run ^TestBuildProjectCmdCtx_AutoDiscoverRespectsRepoConfig$
ok  	github.com/runatlantis/atlantis/server/events	(cached)
atlantis % git checkout respect_server_side_config_for_autodiscover -- server/events/project_command_builder_internal_test.go
atlantis % go test ./server/events -run ^TestBuildProjectCmdCtx_AutoDiscoverRespectsRepoConfig$ | grep FAIL:                 
--- FAIL: TestBuildProjectCmdCtx_AutoDiscoverRespectsRepoConfig (0.01s)
    --- FAIL: TestBuildProjectCmdCtx_AutoDiscoverRespectsRepoConfig/autodiscover_respects_ignore_paths_in_global_config (0.00s)

references

closes: #5772

Signed-off-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
Signed-off-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
@lukemassa lukemassa marked this pull request as ready for review September 30, 2025 22:07
@github-actions github-actions bot added the go Pull requests that update Go code label Sep 30, 2025
@dosubot dosubot bot added the bug Something isn't working label Sep 30, 2025
@lukemassa
Copy link
Contributor Author

One thing I'm not 100% sure on here, is that the logic I wrote means that if the repo sets autodiscover to enabled but does not specify ignore paths, but the global does specify ignore paths, we act as if no ignore paths are specified.

Is this correct, or should I be merging more surgically?

@jamengual
Copy link
Contributor

One thing I'm not 100% sure on here, is that the logic I wrote means that if the repo sets autodiscover to enabled but does not specify ignore paths, but the global does specify ignore paths, we act as if no ignore paths are specified.

Is this correct, or should I be merging more surgically?

that will be very confusing.C
Is there a way to just use globalCfg even if repoCfg is specify and only use repoCfg when no globalCfg is specify?

@lukemassa
Copy link
Contributor Author

lukemassa commented Oct 1, 2025

Works for me!

Signed-off-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
@lukemassa lukemassa force-pushed the respect_server_side_config_for_autodiscover branch from cf00153 to 2f39af2 Compare October 1, 2025 02:05
Signed-off-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
@github-actions github-actions bot added the docs Documentation label Oct 1, 2025
@lukemassa
Copy link
Contributor Author

OK updated to prefer global and only look at repoCfg if global is absent. I also updated the tests and documentation to clarify.

Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
jamengual
jamengual previously approved these changes Oct 1, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 1, 2025
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
@lukemassa lukemassa force-pushed the respect_server_side_config_for_autodiscover branch from b28c96a to 7a82bc3 Compare October 1, 2025 02:39
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
@lukemassa
Copy link
Contributor Author

To get this to work I had to remove a unit test from project_command_builder_test.go. The issue is it's using the unit test's default globalCfg, which has Repos set and Autoenable set on them, and is hard to override. Since the logic is now "if global has it, ignore repoCfg", we can't test ignore_paths there. However we test it in project_command_builder_internal_test.go so we should be ok

Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
@lukemassa lukemassa merged commit 0decfa6 into runatlantis:main Oct 1, 2025
41 checks passed
ramonvermeulen pushed a commit to bschaatsbergen/atlantis that referenced this pull request Oct 13, 2025
Signed-off-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
Co-authored-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
Signed-off-by: Ramon Vermeulen <ramonvermeulen98@gmail.com>
dimisjim pushed a commit to dimisjim/atlantis that referenced this pull request Oct 29, 2025
Signed-off-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
Co-authored-by: Luke Massa <lmassa@Lukes-MacBook-Air.local>
Signed-off-by: dimisjim <dimitris.moraitidis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working docs Documentation go Pull requests that update Go code lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ignore_paths does not work in server side repo config

2 participants