-
Notifications
You must be signed in to change notification settings - Fork 54
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
Default behavior of build variable -on-error=cleanup
is not being respected
#111
Comments
We are also seeing this behavior on 1.8.6. It appears that the default behavior is |
@spencer-cdw @schmidtd do you have a working configuration that I can use to reproduce this issue? I am unable to reproduce with the latest version of the Google Compute plugin and Packer. By default I can see that the OnError flag is unset and that is what is being passed to the SDK, which is what controls the build runner. When onError is unset it defaults to the cleanup step. Locally I see the cleanup happening as expected; setting the Sample template with error in the provisioner: https://gist.github.com/nywilken/3f2276c5b202fa42ff14ab8723a5998a
Is there any other information that you can provide to help figure out what might be happening here. If possible a full debug log might provide some insight into what is being passed. |
I did have one when the issue was written, but now we always explicitly set to cleanup in all cases. If it's working now to actually clean up when unset, it looks like the fix was in the SDK. |
Overview of the Issue
The documented default behavior of the
-on-error
variable iscleanup
. That means that on failure of a packer build, the VM and disk that is created should also be deleted. However, without specifying anything for the-on-error
variable in your build, a failure will keep the VM running and disk resource allocated. This leads to resource leakage in the default case, which is in conflict with the documentation:website/content/docs/commands/build.mdx:- `-on-error=cleanup` (default), `-on-error=abort`, `-on-error=ask`, `-on-error=run-cleanup-provisioner` -
It seems the default behavior is actually
abort
. I am running the plugin as part of a GitHub action pipeline.Reproduction Steps
Create a build that errors out. Any error will do that causes the build step to fail without creating any resources (i.e. see the message
==> Builds finished but no artifacts were created.
)Plugin and Packer version
Installed plugin github.com/hashicorp/googlecompute v1.0.15 in "/github/home/.config/packer/plugins/github.com/hashicorp/googlecompute/packer-plugin-googlecompute_v1.0.15_x5.0_linux_amd64"
Operating system and Environment details
My GitHub actions specify unbuntu:
Log Fragments and crash.log files
Here is the log if you don't specify
-on-error=cleanup
:Here is the log if you explicitly specify
-on-error=cleanup
:The text was updated successfully, but these errors were encountered: