-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Conversation
# https://docs.codecov.com/docs/testing-with-docker | ||
# We normalize CI to `1`; but codecov expects it to be `true` to detect Buildkite... | ||
# Unfortunately, codecov.io fails sometimes: | ||
# curl: (7) Failed to connect to codecov.io port 443: Connection timed out | ||
CODECOV_ENVS=$(CI=true bash <(while ! curl -sS --retry 5 --retry-delay 2 --retry-connrefused https://codecov.io/env; do sleep 10; done)) | ||
retry=5 | ||
while :; do | ||
if ((retry > 0)); then | ||
echo "fetching coverage_env_script..." | ||
else | ||
echo "can't fetch coverage_env_script successfully" | ||
exit 1 | ||
fi | ||
|
||
http_code=$(curl -s -o coverage_env_script -w "%{http_code}" https://codecov.io/env) | ||
if [[ "$http_code" = "200" ]]; then | ||
break | ||
fi | ||
|
||
echo "got http_code $http_code" | ||
retry="$((retry - 1))" | ||
sleep 5 | ||
done | ||
CODECOV_ENVS=$(CI=true bash < coverage_env_script) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, i think we just need to add --fail
like this, relying on curl
... #32494
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, my comment wasn't clear enough for suggesting --fail
at #32490 (comment) ... sorry about that.
or, is there any reason we have to use manual looping? i think curl-based approach is simpler...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstand the --fail
. I thought it will direct the error message into the variable as well. thank you for pointing this out!
use #32494 |
Problem
another solution for #32490.
Summary of Changes
handle curl's http code
it looks like