Skip to content

fix: improve error handling for network connectivity issues - #38

Closed
bussyjd wants to merge 1 commit into
mainfrom
fix/internet-connectivity-error
Closed

fix: improve error handling for network connectivity issues#38
bussyjd wants to merge 1 commit into
mainfrom
fix/internet-connectivity-error

Conversation

@bussyjd

@bussyjd bussyjd commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Summary

Improves error handling throughout the obolup script to provide clear feedback when network connectivity issues occur, rather than failing silently.

Problem Solved

Fixes #28 - When running without internet, obolup now provides clear error messages instead of ending unclearly.

The Issue

Previously, when running obolup without internet connection, the script would fail silently:

[INFO] Checking Kind...
[INFO] Kind v0.27.0 is installed.
[INFO] Checking helm...

And then just stop with no error message, leaving users confused.

Changes

🛡️ Improved Error Handling in All Installation Functions

kubectl installation

  • Check for network failures when fetching version
  • Clear error message when download fails
  • Graceful handling of checksum validation failures

helm installation

  • Detect and report download failures
  • Already had partial error handling, now consistent
  • Falls back to existing installation when updates can't be checked

kind installation

  • Add error handling for download failures
  • Clear error messages for network issues

k9s installation

  • Maintained already good error handling
  • Made consistent with other functions

obol CLI installation

  • Add network failure detection
  • Fallback to existing installation when possible
  • Clear error messages when installation impossible

obolup update checker

  • Handle network failures gracefully
  • Detect empty responses (sha256 of empty string)
  • Continue operation when update check fails

📝 User Experience Improvements

  • ✅ Clear error messages that explicitly mention checking internet connection
  • ✅ Graceful fallback to existing installations when updates can't be checked
  • ✅ Warning messages for non-critical network failures (e.g., checksum downloads)
  • ✅ Fatal errors only when installation is impossible without network

Example Output

Before (silent failure):

[INFO] Checking helm...

(script ends with no explanation)

After (clear error):

[INFO] Checking helm...
[ERROR] helm is not installed and unable to fetch latest version. Please check your internet connection.

Testing

To test these improvements:

  1. Disconnect from internet (turn off WiFi/ethernet)
  2. Run obolup: ./obolup
  3. Verify clear error messages appear for each component that needs network access

For tools already installed:

  • Script continues with warnings about being unable to check for updates
  • Existing installations are used

For tools not installed:

  • Clear error message about checking internet connection
  • Script exits gracefully with helpful error

Impact

  • Users get immediate, actionable feedback about network issues
  • No more confusion from silent failures
  • Script fails fast with clear messaging
  • Existing installations continue to work offline where possible

Related Issue

Closes #28

- Add explicit error messages when curl commands fail due to network issues
- Check for empty responses from API calls before processing
- Provide clear feedback when internet connection is unavailable
- Gracefully handle cases where tools are already installed but updates can't be checked

Fixes #28

@OisinKyne OisinKyne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small asks

Comment thread obolup/obolup
Comment on lines +386 to +390
REMOTE_HASH=$(curl -s "$OBOLUP_URL" 2>/dev/null | sha256sum | awk '{print $1}')
if [[ -z "$REMOTE_HASH" || "$REMOTE_HASH" == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ]]; then
log_warn "Unable to check for obolup updates. Network may be unavailable."
return
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this actually work? i didn't know we had obolup hosted yet.

Comment thread obolup/obolup
if [[ -z "$KUBECTL_VERSION" ]]; then
log_error "Failed to fetch kubectl version. Please check your internet connection."
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a problem for this PR, but we should make a ticket to update kubectl by comparing local kubectl version versus fetched kubectl version and do a which kubectl like we do for k9s and only run the next download if they differ and its the type of installation we expect.

Comment thread obolup/obolup
if ! curl -sSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/$ARCHITECTURE/kubectl.sha256" 2>/dev/null; then
log_warn "Failed to download kubectl checksum. Continuing without validation..."
else
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check || log_warn "kubectl checksum validation failed. Continuing anyway..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lets crash if this fails, it looks sloppy to do the check and continue anyways

@bussyjd
bussyjd marked this pull request as draft October 20, 2025 20:09
@bussyjd bussyjd closed this Oct 20, 2025
@OisinKyne
OisinKyne deleted the fix/internet-connectivity-error branch November 7, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

With no internet, obolup ends unclearly

2 participants