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:drift detection (wip) #4114

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

motatoes
Copy link

@motatoes motatoes commented Jan 1, 2024

(Still a work in progress PR, not ready for review yet, but you are welcome to have a look :))

what

Work in progress Implementation of #3245 drift detection feature. It allows users to configure drift detection for specific projects so atlantis can detect drift and create a pull request based on this change. Working on:

  • Creation of atlantis.yml parameters
  • Creation of server parameters
  • Creation of cron job for drift detection of requested projects
  • Creation of pull request with any detected drift using token
    • Github
    • Gitlab
    • Bitbucket
    • Azure Devops

why

To support drift detection natively in atlantis

tests

  • Test atlantis.yml configuration parameters
  • Test server configuration parameters
  • Test drift detection job

references

@motatoes motatoes requested review from a team as code owners January 1, 2024 13:30
@motatoes motatoes requested review from chenrui333, lukemassa and X-Guardian and removed request for a team January 1, 2024 13:30
@github-actions github-actions bot added the go Pull requests that update Go code label Jan 1, 2024
@motatoes motatoes changed the title Feat:drift detection (wip) feat:drift detection (wip) Jan 1, 2024
@nitrocode nitrocode marked this pull request as draft January 6, 2024 06:51
@barth12
Copy link

barth12 commented Feb 20, 2024

Hi guys, any chance there will be some progress on this one soon? would be beautiful to have this functionality in Atlantis.

@l13t
Copy link

l13t commented May 29, 2024

There is probably no chance since the author works on an alternative solution.

@jeffersontavaresdm
Copy link

I ended up using Driftive and running the drift analysis in GH actions with this action.

@dimisjim dimisjim mentioned this pull request Nov 13, 2024
11 tasks
@dimisjim
Copy link
Contributor

@jeffersontavaresdm The issue with solutions like driftive is that you need to run an additional binary other than Atlantis somewhere, which would need to comply to a different spec (see https://github.com/driftive/driftive?tab=readme-ov-file#repository-configuration), other than the already available repo config yaml that atlantis offers. It would also need to have its own access to the infra Atlantis manages.

Thus I think something like this to begin with: #5087 is the proper way to do it when an org uses Atlantis.

@jamengual
Copy link
Contributor

@jeffersontavaresdm The issue with solutions like driftive is that you need to run an additional binary other than Atlantis somewhere, which would need to comply to a different spec (see https://github.com/driftive/driftive?tab=readme-ov-file#repository-configuration), other than the already available repo config yaml that atlantis offers. It would also need to have its own access to the infra Atlantis manages.

Thus I think something like this to begin with: #5087 is the proper way to do it when an org uses Atlantis.

That is not entirely correct.

We have been discussing for a while to run a cron-like job within Atlantis to run the repo/repos against current infra, then create an issue and a remediation PR and maybe an event to Slack to notify.

Atlantis is already running, so why not use Atlantis itself to trigger the discovery/drift detection and use the already provided access.

@dimisjim
Copy link
Contributor

@jamengual An internal non-API mechanism can work too, sure. However, the API would be possible to be used outside of Atlantis too.

Either way, would be nice for an Atlantis drift detection mechanism to fully support the atlantis repo level yaml config file.

@jamengual
Copy link
Contributor

Sorry, I do not want one or the other; I was saying we can do both.
there is an early incarnation that does something like this here https://github.com/cresta/atlantis-drift-detection

@l13t
Copy link

l13t commented Nov 14, 2024

It would be nice to have an option that says if the plan should be only monitored for drift or will be applied if there is a drift.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drift Detection
6 participants