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

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

Merged
merged 6 commits into from
Sep 11, 2023

Conversation

X-Guardian
Copy link
Contributor

@X-Guardian X-Guardian commented Sep 7, 2023

what

In the DeleteLocksByPull function, replace the deleteWorkingDir function call with WorkingDir.DeletePlan so that only the plan files are deleted for the lock rather than the whole working directory.

Improved logging has also been added to the events_controller, unlock_command_runner and delete_lock_command.

The additional logging in the events_controller module also exposed issues in the TestPost_GitlabCommentSuccess, TestPost_GithubCommentReaction, TestPost_GilabCommentReaction and TestPost_AzureDevopsPullRequestCommentPassingIgnores tests, which have also been fixed.

why

tests

Tested locally

@X-Guardian X-Guardian requested a review from a team as a code owner September 7, 2023 13:48
@github-actions github-actions bot added the go Pull requests that update Go code label Sep 7, 2023
@X-Guardian X-Guardian changed the title Fix: Running 'atlantis unlock' on a PR Causes The Whole Working Directory to be Deleted fix: Running 'atlantis unlock' on a PR Causes The Whole Working Directory to be Deleted Sep 7, 2023
@jamengual jamengual added the waiting-on-review Waiting for a review from a maintainer label Sep 8, 2023
Copy link
Member

@GenPage GenPage left a comment

Choose a reason for hiding this comment

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

LGTM, Curious if there could be unintended consequences if we're not cleaning up the whole directory, but this seems more ideal than just nuking the whole folder

@GenPage GenPage merged commit b459645 into runatlantis:main Sep 11, 2023
@X-Guardian X-Guardian deleted the DeleteLocksByPull-Fix branch November 22, 2023 12:23
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…tory to be Deleted (runatlantis#3751)

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

* Update events controller tests

* Fix events controller tests

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…tory to be Deleted (runatlantis#3751)

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

* Update events controller tests

* Fix events controller tests

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
terakoya76 pushed a commit to terakoya76/atlantis that referenced this pull request Dec 31, 2024
…tory to be Deleted (runatlantis#3751)

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

* Update events controller tests

* Fix events controller tests

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
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 waiting-on-review Waiting for a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running 'atlantis unlock' on a PR Causes The Whole Working Directory to be Deleted
4 participants