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

feat: add autodiscover enabled feature #3895

Merged
merged 17 commits into from
Nov 29, 2023

Conversation

jskrill
Copy link
Contributor

@jskrill jskrill commented Oct 24, 2023

what

  • Added repo configuration settings {"autodiscover": {"mode": "enabled|disabled|auto"}}
  • This feature allows Atlantis to discover projects which aren't enumerated in the repo configuration even if the repo configuration is given
  • This feature also allows disabling autodiscover entirely

why

  • The utility of this feature is when a user has many projects in a repo and is generally satisfied with the auto discovery logic but needs custom configuration for a limited subset of projects
  • Without this feature, the user would have to list every project in their repo in the config file if even if they only wanted to configure one

tests

  • I added unit tests for the feature
  • I manually tested the changes in a test repo I set up

references

@jskrill jskrill requested a review from a team as a code owner October 24, 2023 22:34
@github-actions github-actions bot added docs Documentation go Pull requests that update Go code labels Oct 24, 2023
@jamengual jamengual added feature New functionality/enhancement waiting-on-review Waiting for a review from a maintainer labels Oct 24, 2023
@jskrill jskrill changed the title feat: add discover_projects_with_missing_config feature feat: add autodiscover enabled feature Oct 25, 2023
@nitrocode
Copy link
Member

@jskrill if you have time, could you test out this build in your setup?

I don't know if you know this but you can create a PR in your fork to merge your feature branch into your fork's main branch, cut a release e.g. v0.27.0, and a ghcr image will be uploaded in your fork to test with. This would give us more confidence that this is working as expected. That and adding any additional tests.

Thanks again for all your efforts.

@jskrill
Copy link
Contributor Author

jskrill commented Nov 2, 2023

@nitrocode I built ghcr.io/jskrill/atlantis:v0.27.0 if you wanna try it out.

I've been testing all this while with Atlantis deployed to my local k8s cluster (using Tilt to automate the build/deploy cycle).

I've been using a PR in this repo for manual testing: jskrill/terraform-atlantis-test#9

As far as unit tests go, I'm think the ones I've written cover the feature pretty well. Let me know if you want any additional testing evidence/etc.

Thanks.

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few quote suggestions

cmd/server.go Outdated Show resolved Hide resolved
runatlantis.io/docs/server-configuration.md Outdated Show resolved Hide resolved
runatlantis.io/docs/server-configuration.md Outdated Show resolved Hide resolved
runatlantis.io/docs/server-configuration.md Outdated Show resolved Hide resolved
server/core/config/valid/global_cfg.go Show resolved Hide resolved
server/core/config/valid/repo_cfg.go Show resolved Hide resolved
server/events/project_command_builder.go Outdated Show resolved Hide resolved
server/events/project_command_builder.go Outdated Show resolved Hide resolved
server/events/project_command_builder.go Outdated Show resolved Hide resolved
server/events/project_command_builder.go Outdated Show resolved Hide resolved
server/events/project_command_builder.go Outdated Show resolved Hide resolved
nitrocode
nitrocode previously approved these changes Nov 2, 2023
Copy link
Member

@nitrocode nitrocode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I'll defer to another maintainer to review and merge.

Copy link
Contributor

@lukemassa lukemassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! The buildAllCommandsByCfg function is getting pretty long and hard to read with all its if/elses, but that's a pre-existing condition. I left a few small comments

server/core/config/valid/global_cfg_test.go Outdated Show resolved Hide resolved
server/events/project_command_builder.go Outdated Show resolved Hide resolved
server/events/project_command_builder_test.go Show resolved Hide resolved
server/core/config/valid/repo_cfg.go Show resolved Hide resolved
jamengual
jamengual previously approved these changes Nov 5, 2023
server/core/config/raw/autodiscover_test.go Outdated Show resolved Hide resolved
@jskrill
Copy link
Contributor Author

jskrill commented Nov 9, 2023

Are we good to merge?

@jskrill
Copy link
Contributor Author

jskrill commented Nov 29, 2023

Polite bump on this. Are there any other changes needed?

@jamengual
Copy link
Contributor

@jskrill LGTM Thanks for the contribution

@jamengual jamengual merged commit 00aae56 into runatlantis:main Nov 29, 2023
24 checks passed
@nitrocode
Copy link
Member

Thanks for all your work @jskrill !

ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
* add flag to allow the user disable the autodiscover

* add global config and doc

* feat: Implement autodiscover.mode

* fix: Minor doc fixes

* fix: Small fixes to docs/indent/tests

* fix: Line length, quoting, function comments

* fix: Add a few more tests and remove newlines

* fix: Always camel case never snake

---------

Co-authored-by: Marcelo Medeiros <[email protected]>
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: PePe Amengual <[email protected]>
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
* add flag to allow the user disable the autodiscover

* add global config and doc

* feat: Implement autodiscover.mode

* fix: Minor doc fixes

* fix: Small fixes to docs/indent/tests

* fix: Line length, quoting, function comments

* fix: Add a few more tests and remove newlines

* fix: Always camel case never snake

---------

Co-authored-by: Marcelo Medeiros <[email protected]>
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: PePe Amengual <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation feature New functionality/enhancement go Pull requests that update Go code waiting-on-review Waiting for a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define projects in atlantis.yaml and allow undefined projects to auto plan
6 participants