Skip to content

west: blobs: fetch exit immediately on HTTP error #90231

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

Merged

Conversation

noahp
Copy link
Contributor

@noahp noahp commented May 20, 2025

If an HTTP error occurs during west blobs fetch, the response was written to a file (even if the response body is empty), and then the checksum validation fails, which can be somewhat confusing.

Add an immediate error message and exit-with-error-code when the HTTP request fails.

Tested by modify a blob manifest to have an invalid URL:

# test with invalid URL
❯ west blobs fetch nrf_wifi
Fetching blob nrf_wifi: /home/noah/dev/zephyrs/main/modules/lib/nrf_wifi/zephyr/blobs/wifi_fw_bins/default/nrf70.bin
ERROR: HTTP error occurred: 404 Client Error: Not Found for url: https://github.com/nrfconnect/sdk-nrfxlib/raw/863f1b54a563d2139cc26514a56817feb0f91e61/zzzz/nrf_wifi/bin/zephyr/default/nrf70.bin

# test with networking disabled
❯ west blobs fetch nrf_wifi
Fetching blob nrf_wifi: /home/noah/dev/zephyrs/main/modules/lib/nrf_wifi/zephyr/blobs/wifi_fw_bins/default/nrf70.bin
ERROR: An error occurred: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /nrfconnect/sdk-nrfxlib/raw/863f1b54a563d2139cc26514a56817feb0f91e61/zzzz/nrf_wifi/bin/zephyr/default/nrf70.bin (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7bef7c4b9a90>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))

@github-actions github-actions bot added the area: West West utility label May 20, 2025
@noahp noahp force-pushed the noahp/west-blobs-fetch-http-error-exit branch from cc078c8 to 8a50fb9 Compare May 20, 2025 17:49
@noahp noahp requested a review from pdgendt May 21, 2025 15:47
@pdgendt
Copy link
Collaborator

pdgendt commented May 21, 2025

You need to squash your commits into a single one, and force push.

@noahp noahp force-pushed the noahp/west-blobs-fetch-http-error-exit branch from cb4dda6 to 85eee4b Compare May 21, 2025 21:01
@noahp
Copy link
Contributor Author

noahp commented May 21, 2025

You need to squash your commits into a single one, and force push.

All set, thank you!

@noahp noahp force-pushed the noahp/west-blobs-fetch-http-error-exit branch from 85eee4b to cae0059 Compare May 21, 2025 21:22
If an HTTP error occurs during `west blobs fetch`, the response was written
to a file (even if the response body is empty), and then the checksum
validation fails, which can be somewhat confusing.

Add an immediate error message and exit-with-error-code when the HTTP
request fails.

Tested by modify a blob manifest to have an invalid URL:

```bash
# test with invalid URL
❯ west blobs fetch nrf_wifi
Fetching blob nrf_wifi: .../wifi_fw_bins/default/nrf70.bin
ERROR: HTTP error occurred: 404 Client Error: Not Found for url: ...

# test with networking disabled
❯ west blobs fetch nrf_wifi
Fetching blob nrf_wifi: .../wifi_fw_bins/default/nrf70.bin
ERROR: An error occurred: HTTPSConnectionPool(host='git.... \
  Max retries exceeded with url: \
  .../zzzz/nrf_wifi/bin/zephyr/default/nrf70.bin
...
```

Signed-off-by: Noah Pendleton <[email protected]>
@noahp noahp force-pushed the noahp/west-blobs-fetch-http-error-exit branch from cae0059 to 5e0a531 Compare May 21, 2025 21:38
Copy link

@kartben kartben merged commit 7f1a639 into zephyrproject-rtos:main May 28, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants