codecov / codecov-cli

Codecov's Command Line Interface. Used for uploading to Codecov in your CI, Test Labelling, Local Upload, and more
Apache License 2.0
54 stars 38 forks source link

Tokenless upload is being used when token is available #460

Closed AlekSi closed 3 months ago

AlekSi commented 3 months ago

We have a public repo with the upload token stored in plaintext in GitHub Actions YAML configuration (because that's the best we can do given how secrets and even vars are working). We send PRs from public forks. v0.7.0, released several hours ago, broke our uploads:

I think the reason is somewhere between https://github.com/codecov/codecov-cli/pull/447, https://github.com/codecov/codecov-action/pull/1410, and https://github.com/codecov/codecov-action/pull/1471. Weirdly, the last PR should supposedly fix our situation, but we still saw "Fork detected, tokenless uploading used" message in logs.

Balandat commented 3 months ago

We're having what seems to be a related issue (modulo the fact that we don't have the secret in plaintext) over at https://github.com/facebook/Ax and https://github.com/pytorch/botorch. Our setup worked with 0.6.0 but broke with 0.7.0. Interestingly, the uploader correctly recognizes that "The PR is happening in a forked repo. Using tokenless upload." but then proceeds to error out that the token is not found:

==> Running version v0.7.0
==> Running git config --global --add safe.directory /home/runner/work/botorch/botorch
/usr/bin/git config --global --add safe.directory /home/runner/work/botorch/botorch
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-commit'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-commit --git-service github -C e52e5c04b78fc180526d786015a9a086be3fd060 -Z
info - 2024-06-20 21:00:[40](https://github.com/pytorch/botorch/actions/runs/9604216785/job/26489203697#step:8:41),145 -- ci service found: github-actions
warning - 2024-06-20 21:00:40,153 -- No config file could be found. Ignoring config.
info - 2024-06-20 21:00:40,155 -- The PR is happening in a forked repo. Using tokenless upload.
info - 2024-06-20 21:00:40,250 -- Process Commit creating complete
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-report'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov create-report --git-service github -C e52e5c04b78fc180526d786015a9a086be3fd060 -Z
info - 2024-06-20 21:00:[41](https://github.com/pytorch/botorch/actions/runs/9604216785/job/26489203697#step:8:42),006 -- ci service found: github-actions
warning - 2024-06-20 21:00:41,014 -- No config file could be found. Ignoring config.
Error: Codecov token not found. Please provide Codecov token with -t flag.

Our config lives here: https://github.com/facebook/Ax/blob/main/.github/workflows/reusable_test.yml#L64-L70

joseph-sentry commented 3 months ago

Hi, thanks for filing an issue! 0.7.0 is indeed broken :/ We've just released 0.7.1 with a fix, and 0.6.0 should work fine as well. Sorry for the inconvenience.

AlekSi commented 3 months ago

I can confirm that 0.7.1 works now.