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

atlantis unlock results in misleading error: Failed to delete PR locks #3877

Closed
bschaatsbergen opened this issue Oct 20, 2023 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@bschaatsbergen
Copy link
Member

bschaatsbergen commented Oct 20, 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

Since v0.26.0 I keep getting "Failed to delete PR locks" when commenting atlantis unlock, and actually the locks are deleted successfully without any issue.

Reproduction Steps

Logs

Environment details

Additional Context

It was introduced here possibly https://github.com/runatlantis/atlantis/pull/3751/files#diff-718a5cf3b673c927e6c880baa4e7a7be3e729fe0a74e6749b89c39448f8ef83cR61

// The locks controller currently has no implementation of Atlantis project names, so this is hardcoded to an empty string.
	projectName := ""

and then calls

removeErr := l.WorkingDir.DeletePlan(lock.Pull.BaseRepo, lock.Pull, lock.Workspace, lock.Project.Path, projectName)

DeletePlan calls GetPlanFilename to get the plan filename (here)

// GetPlanFilename returns the filename (not the path) of the generated tf plan
// given a workspace and project name.
func GetPlanFilename(workspace string, projName string) string {
	if projName == "" {
		return fmt.Sprintf("%s.tfplan", workspace)
	}
	projName = strings.Replace(projName, "/", planfileSlashReplace, -1)
	return fmt.Sprintf("%s-%s.tfplan", projName, workspace)
}

but since 0.26, starting on the PR above, the projName is empty, so the filename will always be %s.tfplan, but in my case it should’ve been %s-%s.tfplan like you show on you plan command

@bschaatsbergen bschaatsbergen added the bug Something isn't working label Oct 20, 2023
@bschaatsbergen
Copy link
Member Author

I would happily prep a fix for this bug 👍🏼

@jamengual
Copy link
Contributor

jamengual commented Oct 20, 2023 via email

@nitrocode
Copy link
Member

nitrocode commented Oct 20, 2023

Duplicate of #3856 which is a duplicate of #3845

@nitrocode nitrocode marked this as a duplicate of #3856 Oct 20, 2023
@nitrocode
Copy link
Member

Yes please put in a PR. I followed the thread in slack. Great sleuthing by Gabriel and hoping for a fix soon!

Only closing to consolidate conversation in original ticket

@X-Guardian
Copy link
Contributor

@bschaatsbergen, please read #3845 (comment) before starting work on a PR.

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
Development

No branches or pull requests

4 participants