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

Return an error on unlock failure #25729

Merged
merged 3 commits into from
Sep 3, 2020
Merged

Return an error on unlock failure #25729

merged 3 commits into from
Sep 3, 2020

Conversation

grahamhar
Copy link
Contributor

This attempts to fix Issue 23017

When the lock can't be released return the err even if there is no previous error with the current action. This allows faster failure in CI/CD systems. Without this failure to remove the lock would result in the failure happening on a subsequent plan or apply which slows down the feedback loop in automated systems.

@hashicorp-cla
Copy link

hashicorp-cla commented Aug 3, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Aug 3, 2020

Codecov Report

Merging #25729 into master will increase coverage by 0.37%.
The diff coverage is n/a.

Impacted Files Coverage Δ
internal/getproviders/http_mirror_source.go 0.00% <0.00%> (-71.43%) ⬇️
internal/getproviders/hash.go 0.00% <0.00%> (-58.34%) ⬇️
configs/hcl2shim/values.go 47.95% <0.00%> (-34.50%) ⬇️
terraform/eval_state_upgrade.go 45.65% <0.00%> (-17.51%) ⬇️
command/version.go 54.43% <0.00%> (-12.24%) ⬇️
internal/getproviders/legacy_lookup.go 42.42% <0.00%> (-8.86%) ⬇️
lang/funcs/cidr.go 77.50% <0.00%> (-7.12%) ⬇️
backend/local/backend_refresh.go 35.41% <0.00%> (-6.10%) ⬇️
command/hook_ui.go 66.36% <0.00%> (-6.04%) ⬇️
backend/local/backend_local.go 36.89% <0.00%> (-4.34%) ⬇️
... and 91 more

Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

Hi @grahamhar ! Thank you for submitting this, it's a subtle little bug!

I'd like to second @ZymoticB's suggested change - thank you for that, @ZymoticB - as it's an elegant simplification.

I'd also really like to see tests in this package. There aren't any now, and it's certainly a bigger task than you signed up for when you opened this PR, so I'm absolutely not going to require this from you for this PR. I'll take a look at this package and see if there's a relatively simple test I can suggest (or add myself, if you gave us access to push to your fork).

@mildwonkey mildwonkey self-assigned this Aug 12, 2020
@grahamhar
Copy link
Contributor Author

Hi @grahamhar ! Thank you for submitting this, it's a subtle little bug!

I'd like to second @ZymoticB's suggested change - thank you for that, @ZymoticB - as it's an elegant simplification.

I'd also really like to see tests in this package. There aren't any now, and it's certainly a bigger task than you signed up for when you opened this PR, so I'm absolutely not going to require this from you for this PR. I'll take a look at this package and see if there's a relatively simple test I can suggest (or add myself, if you gave us access to push to your fork).

Added the suggested change and given you access if you want to add test coverage at https://github.com/grahamhar/terraform

@mildwonkey
Copy link
Contributor

mildwonkey commented Aug 12, 2020

[EDIT]: It just hit me that this is technically a breaking change, so I am going to label it as such and defer merging until the master branch switches to the 0.14 development cycle - that should be later this month. This conveniently gives me some extra time to add that test, too!

Thanks @grahamhar ! You were much quicker than I expected, so I will merge this as-is. I nearly have testing worked out, but it's rather ugly, so I'll need a little more time, though I have been able to validate your fix.

@grahamhar
Copy link
Contributor Author

[EDIT]: It just hit me that this is technically a breaking change, so I am going to label it as such and defer merging until the master branch switches to the 0.14 development cycle - that should be later this month. This conveniently gives me some extra time to add that test, too!

Thanks @grahamhar ! You were much quicker than I expected, so I will merge this as-is. I nearly have testing worked out, but it's rather ugly, so I'll need a little more time, though I have been able to validate your fix.

I did expect that to be the case. Thanks for the quick review and looking forward to the release of 0.14 :)

grahamhar and others added 3 commits September 3, 2020 15:54
When the lock can't be released return the err even if there is no previous error with the current action. This allows faster failure in CI/CD systems. Without this failure to remove the lock would result in the failure happening on a subsequent plan or apply which slows down the feedback loop in automated systems.
Accept review suggestion

Co-authored-by: ZymoticB <[email protected]>
Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

We just cut a 0.13 branch and can start merging work targeting 0.14 🎉

I pushed a test (and rebased) so we're good to go - thank you @grahamhar!

@mildwonkey mildwonkey merged commit e9394df into hashicorp:master Sep 3, 2020
@ghost
Copy link

ghost commented Oct 13, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform exit code is 0 when state lock deletion fails
4 participants