Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

ci: improve CODECOV_ENVS setting #32492

Closed
wants to merge 3 commits into from

Conversation

yihau
Copy link
Contributor

@yihau yihau commented Jul 14, 2023

Problem

another solution for #32490.

Summary of Changes

handle curl's http code

it looks like

Screenshot 2023-07-14 at 2 40 20 PM

@yihau yihau force-pushed the fix-coverage-env2 branch from 01c3744 to ea96a62 Compare July 14, 2023 08:32
Comment on lines +111 to +131
# 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)
Copy link
Contributor

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

Copy link
Contributor

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...

Copy link
Contributor Author

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!

@yihau
Copy link
Contributor Author

yihau commented Jul 14, 2023

use #32494

@yihau yihau closed this Jul 14, 2023
@yihau yihau deleted the fix-coverage-env2 branch July 14, 2023 08:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants