-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Discarding a Plan Causes the Whole Working Directory to be Deleted #3553
Conversation
Maintainers, this PR is ready for review. |
@GenPage relates to ADRs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change but I fear incomplete in the grand scheme of the ADR-002 (#3345 . Right now the workingDir and locks controller don't have a complete understanding of project names which you have found.
The focus with the ADR is to clean up previous code that attempted to add paths to the workingDir/workingDirLocker. It also tries to help contributors understand the call stack to improve unnecessary cloning when operating on repos.
I'm not trying to block the PR. My main concern is around completely removing the workingDir lock for releasing locks/deleting plans. Happy to discuss further.
Hi @GenPage, thanks for the feedback. I understand your comments, and agree that further work is required in the future with regard to the lock handling. I don't believe the changes in this PR block any future changes or make them harder though. Users can still release all locks with the |
There was a problem hiding this 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
what
DeleteLock
function, remove theWorkingDirLocker.TryLock
andWorkingDir.DeleteForWorkspace
function calls as these are not needed as the function has already calledDeleteLockCommand.DeleteLock
.DeleteLockCommand.DeleteLock
function, replace the call todeleteWorkingDir
with a call to the new functionWorkingDir.DeletePlan
. Note:projectName
has to be hard coded to an empty string as the Locks Controller currently has no knowledge of Atlantis project names.WorkingDir.DeletePlan
function to theevents
package with code to build the required plan file path and the delete the file. A logger has also been added to theFileWorkspace
type.why
tests
Tested locally