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

Running 'atlantis unlock' on a PR Causes The Whole Working Directory to be Deleted #3750

Closed
X-Guardian opened this issue Sep 7, 2023 · 0 comments · Fixed by #3751
Closed
Labels
bug Something isn't working

Comments

@X-Guardian
Copy link
Contributor

X-Guardian commented Sep 7, 2023

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

Similar to #3531, when running an atlantis unlock command on a PR, the whole working directory is deleted, rather than just the plan files. This is an issue especially on PRs with a large number of plans, as the next plan on the PR must then go through the terraform init process again for each plan, playing the 'Russian Roulette' as to whether the outstanding race condition with the Terraform provider cache will cause a failure as discussed in hashicorp/terraform#31964.

Reproduction Steps

  1. Create a PR that contains changes for at least one plan.
  2. Comment atlantis plan on the PR.
  3. On the Atlantis server, check that the working directory for the PR has been created and the relevant repo branch has been cloned into it, and the relevant tfplan files created.
  4. Comment atlantis unlock on the PR.
  5. On the Atlantis server, see that the working directory for the PR is now empty.

Environment details

  • Atlantis version: 0.25.0

Additional Context

I recommend changing the DeleteLocksByPull function here

l.deleteWorkingDir(lock)
to call WorkingDir.DeletePlan rather than deleteWorkingDir which would mean just the plan files are deleted, and the working directory remains, complete with any initialised Terraform folders.

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
1 participant