Skip to content

Hide (confusing) curl errors in download-hz-dist outside of debug execution - #83

Merged
JackPGreen merged 2 commits into
masterfrom
Enable-error-display-in-debug-mode-for-curl
Sep 13, 2026
Merged

JackPGreen merged 2 commits into
masterfrom
Enable-error-display-in-debug-mode-for-curl

Conversation

@JackPGreen

@JackPGreen JackPGreen commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

See Slack discussion - the action tries downloading from n locations, expecting (at most) one to contain the requested distribution. But printing n-1 curl 404 errors to the logs in the case of success is confusing UX.

Instead, lets only log those error messages in debug mode - when we might have the context (e.g. URL) to make any sense of them.

Example execution

Add conditional curl argument for showing errors in debug mode.
@JackPGreen JackPGreen changed the title Enable error display in debug mode for curl Hide (confusing) curl errors in download-hz-dist outside of debug execution Sep 11, 2026
@JackPGreen
JackPGreen marked this pull request as ready for review September 11, 2026 13:36
--location
--output "${{ steps.derive-output-file.outputs.file }}"
--retry 5
--retry-all-errors

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.

This hides the noise, but most of it comes from --retry-all-errors - with --fail it retries 404s too, so every repo that doesn't have the artifact costs 5 retries (~31s) and 6 error lines. In the debug run the 3 misses took ~95s before snapshot-internal answered. 404 is the expected answer from n-1 repos here.

Shouldn't we drop --retry-all-errors instead? Plain --retry still retries timeouts and 408/429/5xx. WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't we drop --retry-all-errors instead? Plain --retry still retries timeouts and 408/429/5xx. WDYT?

I don't think so - I'm sure there are some cases of "non-retriable" errors where actually we do want to retry. It was GitHub, not JFrog/Maven, but intermittently returning 404 - #72 / https://github.com/orgs/community/discussions/53538

3 misses took ~95s before

Interesting - maybe a future optimisation could be to parallelise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Your right, revisited - #84

Comment thread download-hz-dist/action.yml Outdated
--silent
)

if [[ "${RUNNER_DEBUG:-}" == "1" ]]; then

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.

With this, when all repos fail a regular run only logs Distribution not found in ... - a 401 from JFrog, a timeout and a real 404 look the same, and you need a debug re-run to tell them apart.

Couldn't we keep --show-error, capture stderr and print it only on failure? The RUNNER_DEBUG check goes away too - echodebug already hides it outside debug runs:

if curl_error=$(curl "${curl_args[@]}" --show-error "${url}" 2>&1); then
  ...
else
  echodebug "Failed to download from ${url}: ${curl_error}"
  errors+="${url}: ${curl_error}"$'\n'
fi
...
echoerr "Distribution not found:"$'\n'"${errors}"

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a better solution - just more complex to implement. Initial approach was just a "quick win", but I've flipped to this instead.

4b69e22

Thinking aloud there might be an even more GitHub-centric solution with groups... but this will do.

@JackPGreen
JackPGreen force-pushed the Enable-error-display-in-debug-mode-for-curl branch from 8324639 to 4b69e22 Compare September 11, 2026 14:15
@sonarqubecloud

Copy link
Copy Markdown

else
echodebug "Failed to download from ${url}"
echodebug "Failed to download from ${url}: ${curl_error}"
errors+="${url}: ${curl_error}"$'\n'

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.

NIT

extra \n

errors+="${url}: $'\n${curl_error}"$'\n\n'

URLfeels long!

done <<< "${{ steps.derive-repositories.outputs.repositories }}"

echoerr "Distribution not found in ${{ steps.derive-repositories.outputs.repositories }}"
echoerr "Distribution not found:"$'\n'"${errors}"

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.

will end up printing twice when error and debug?

may be don't accumulate and just echodebug above and then say here like
echoerr "Distribution download failed. See errors above!"

or

accumulate and then echo the lot before exit

personally like to see the errors without debug!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will end up printing twice when error and debug?

Debug prints command execution (i.e. set -x) so you'd get duplication anyway - just logging the calls passed to the echo functions in addition to what they do.

may be don't accumulate and just echodebug above and then say here like echoerr "Distribution download failed. See errors above!"

But @ldziedziul's point was for non-debug failure executions, we still want the logs, without re-executing. But not for successful. So we need to accumulate the logs.

@JackPGreen
JackPGreen requested a review from nishaatr September 11, 2026 16:03
@JackPGreen
JackPGreen merged commit 29a2c8b into master Sep 13, 2026
43 checks passed
@JackPGreen
JackPGreen deleted the Enable-error-display-in-debug-mode-for-curl branch September 13, 2026 16:22
JackPGreen added a commit that referenced this pull request Sep 22, 2026
When building Docker images, [we spend more time downloading the
binaries than we do actually building the
image](https://github.com/hazelcast/hazelcast-docker/actions/runs/35606429681/job/106354587693).

Specifically, `retry-all-errors` makes sense when we expect the resource
to be present - even if the server returns a `404`, if we _know_ the
resource should be there, retrying is sensible. But in this case, we
_don't_ know, and the "`404` but actually not really" scenario only
applies to GitHub - not Maven central/JFrog. So retrying again and again
before trying the next server _candidate_ on the list wastes time.

By tweaking the retry condition to retry on more retry-appropriate
errors, we can drop typical execution from [`1m
40s`](https://github.com/hazelcast/docker-actions/actions/runs/34609059099/job/103294644256#step:2:1)
to
[`4s`](https://github.com/hazelcast/docker-actions/actions/runs/35608547146/job/106361602018#step:2:1).

Raised from [PR
feedback](#83 (comment)).
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.

3 participants