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

ci: pass coverage env statically #32490

Closed
wants to merge 1 commit into from

Conversation

yihau
Copy link
Contributor

@yihau yihau commented Jul 14, 2023

Problem

https://discord.com/channels/428295358100013066/560503042458517505/1129158185052278854

we may get this message when fetching CODECOV_ENV

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

seems that we don't handle this error and also I think those environment variables won't change. we can just passed them.

Summary of Changes

pass those environment variables statically instead of a dynamic method, setting via curl.

@yihau yihau force-pushed the fix-coverage-env branch from 9eb01b2 to 9a986f2 Compare July 14, 2023 04:43
@yihau
Copy link
Contributor Author

yihau commented Jul 14, 2023

looks all good and coverage report was uploaded successfully.

the test build https://buildkite.com/solana-labs/solana/builds/99028 (ignore the spl test cuz I forgot to rebase when I ran it 😢)
the coverage report: https://app.codecov.io/github/solana-labs/solana/commit/9eb01b2d699adbd12a47476d2aac8268423ba5bf

@yihau yihau requested review from ryoqun and CriesofCarrots July 14, 2023 04:46
@yihau yihau marked this pull request as ready for review July 14, 2023 04:46
@yihau yihau added v1.14 v1.16 PRs that should be backported to v1.16 automerge Merge this Pull Request automatically once CI passes labels Jul 14, 2023
Comment on lines +113 to +126
ARGS+=(
--env CODECOV_ENV
--env CODECOV_TOKEN
--env CODECOV_URL
--env CODECOV_SLUG
--env VCS_COMMIT_ID
--env VCS_BRANCH_NAME
--env VCS_PULL_REQUEST
--env VCS_SLUG
--env VCS_TAG
--env CI_BUILD_URL
--env CI_BUILD_ID
--env CI_JOB_ID
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like avoid hard-coding as much as possible. i know i'm opiniated and seldom these envs should change. but i just don't like hard-coding....

seems curl --fail does the trick.

$ curl -sS --retry 5 --retry-delay 2 --retry-connrefused https://codecov.io/env
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>
#!/usr/bin/env bash

# Apache License Version 2.0, January 2004
# https://github.com/codecov/codecov-bash/blob/master/LICENSE

$ curl --fail -sS --retry 5 --retry-delay 2 --retry-connrefused https://codecov.io/env
#!/usr/bin/env bash

# Apache License Version 2.0, January 2004
# https://github.com/codecov/codecov-bash/blob/master/LICENSE

set -e +o pipefail

VERSION="1.0.6"  

add()
{
  if [ -z "$1" ];
  then
    return
  fi

Copy link
Contributor

Choose a reason for hiding this comment

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

the problem is that curl is printing 502 response body. blame flaky codecov infra.
seems their infra changed when i added this at #8263. so blame me as well. ;)

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 do this cuz

  1. we can see what we're passing easily also make it controllable.
  2. although we pass those env dynamically, we still need to set them manually to machines or we get an empty env in the CI environment

What's the benefit you would like to keep the dynamic environment variable set

Copy link
Contributor

@ryoqun ryoqun Jul 14, 2023

Choose a reason for hiding this comment

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

(sorry i have to go to chore soon)

What's the benefit you would like to keep the dynamic environment variable set

i'd say a maintenance burden. for example, this pr starts to miss to export some of these envs, which is used for codecov report metadata... these env set can change anytime by codecov.

elif [ "$CI" = "true" ] && [ "$BUILDKITE" = "true" ];
then
  add "CI"
  add "BUILDKITE"
  add "BUILDKITE_BRANCH"
  add "BUILDKITE_BUILD_NUMBER"
  add "BUILDKITE_JOB_ID"
  add "BUILDKITE_BUILD_URL"
  add "BUILDKITE_PROJECT_SLUG"
  add "BUILDKITE_COMMIT"

also, codocov doc is recommending to call curl dynamically...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true. it is easy to miss some needed environment variables. just opened another solution for handling curl response code. #32492

Copy link
Contributor

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

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

thanks for debugging this. however, i want different approach is taken..

@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-env branch July 14, 2023 08:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge Merge this Pull Request automatically once CI passes v1.16 PRs that should be backported to v1.16
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants