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

Add iso_timeout (or iso_download_timeout) option #12684

Open
ladar opened this issue Nov 6, 2023 · 2 comments
Open

Add iso_timeout (or iso_download_timeout) option #12684

ladar opened this issue Nov 6, 2023 · 2 comments
Labels
enhancement stage/waiting-on-upstream This issue is waiting on an upstream change

Comments

@ladar
Copy link
Contributor

ladar commented Nov 6, 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
  • 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

Description

If a network connection is interrupted during an ISO download (via HTTP/HTTPS) packer doesn't abort, it just sort of hangs indefinitely (from what I could tell, it would hang until the ETA is exhausted).

If a network connection is restored the download doesn't appear to resume either... so it's not retrying.

To simulate this I would start a download, and then stop/restart my VPN. I also tried simulating the issue by replacing the default route with one that would return a 'Destination Net Prohibited' error. There didn't appear to be a difference in either case.

Use Case(s)

If a network issue, or remote server interrupts a download, I'd like to control how quickly packer fails, and moves onto downloading the next ISO. My scripts will then retry the download failures at the end.

In that same vein, it would be nice if packer used a different exit code for ISO download failures, as opposed to always returning 1. For example returning a 5 if the download/checksum fails. That would make it easier to detect download issues, and differentiate them from syntax/build/post-processor errors.... perhaps leaving 1 for when multiple builds are being processed and they fail at different stages.

If your worried about backwards compatibility, this feature could be enabled via a CLI option and/or environment variable, such as -extend-exit-codes or PACKER_EXTEND_CODES ...

Potential configuration

curl -Lso packer-cache-x64.json https://raw.githubusercontent.com/lavabit/robox/49dc89d5a7e2cf3cfe9e33acb713b9ec72a2d9bb/generic-libvirt-x64.json
packer build -parallel-builds=1 -only=debian8-x64,opensuse15-x64 packer-cache-x64.json
@ladar
Copy link
Contributor Author

ladar commented Nov 6, 2023

Just to clarify, this "timeout" should happen when no data if a download hasn't received any data for X amount of time. It should not be applied as a total time limit...

Also, in a perfect world we could also configure a minimum speed threshold for timeouts... like the 'cURL' options --speed-time and --speed-limit ...

@nywilken nywilken added the stage/waiting-on-upstream This issue is waiting on an upstream change label Nov 10, 2023
@nywilken
Copy link
Contributor

Hi @ladar thanks for opening up this request. The downloading of ISOs is handled by an upstream library hashicorp/go-getter so I have labelled this as an upstream request. I don't know that we will be able to get to this request soon but you are more than welcome to open a PR against go-getter if you would like to work on adding the feature.

I'm keeping so we can revisit at a later time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stage/waiting-on-upstream This issue is waiting on an upstream change
Projects
None yet
Development

No branches or pull requests

2 participants