hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.06k stars 3.32k forks source link

Should not retry non-retryable errors #5856

Closed mwhooker closed 6 years ago

mwhooker commented 6 years ago

With the shell type uploaders, we first upload a temporary script and then execute it remotely. This happens in a "retry loop". If we have an issue testing the remote we retry until we timeout, making no progress.

My suggestion is to annotate the error type with information about whether it's retryable or not, but that is difficult because at the moment error types don't cross RPC boundaries. i.e. https://github.com/hashicorp/packer/compare/nonretryableerrors

eg

==> azure-arm: Provisioning with Powershell...
2018/02/06 12:02:20 packer: 2018/02/06 12:02:20 Found command: Write-Output("HELLO SWAMPY I AM POWERSHELL WOOOOOO 1")
2018/02/06 12:02:20 ui: ==> azure-arm: Provisioning with powershell script: /var/folders/yy/ff0tkhr141xdxvxf5fz43kmw0000gn/T/packer-powershell-provisioner139375060
==> azure-arm: Provisioning with powershell script: /var/folders/yy/ff0tkhr141xdxvxf5fz43kmw0000gn/T/packer-powershell-provisioner139375060
2018/02/06 12:02:20 packer: 2018/02/06 12:02:20 Opening /var/folders/yy/ff0tkhr141xdxvxf5fz43kmw0000gn/T/packer-powershell-provisioner139375060 for reading
2018/02/06 12:02:20 packer: 2018/02/06 12:02:20 [INFO] 55 bytes written for 'uploadData'
2018/02/06 12:02:20 [INFO] 55 bytes written for 'uploadData'
2018/02/06 12:02:21 packer: 2018/02/06 12:02:21 Retryable error: Error uploading script: Couldn't determine whether destination was a folder or file: http response error: 401 - invalid content type
2018/02/06 12:02:23 packer: 2018/02/06 12:02:23 [INFO] 55 bytes written for 'uploadData'
2018/02/06 12:02:23 [INFO] 55 bytes written for 'uploadData'

It's also possible that the timeouts are short enough that we can retry these errors until the build fails (i.e. the real issue may be that powershell doesn't work, and retrying a non-retryable error is the secondary concern)

SwampDragons commented 6 years ago

Did some testing on this and I have two take-aways so far. 1) it isn't an infinite loop; it'll time out after 5 minutes and 2) I think I've found a workaround. Will share after cleaning it up.

mwhooker commented 6 years ago

Will address this in future work

ghost commented 4 years ago

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.