Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Disable failing on code coverage report upload, Codecov has issues #451

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

amotl
Copy link
Member

@amotl amotl commented Oct 4, 2022

Problem

Code coverage report upload to Codecov started failing intermittently. Example: https://github.com/crate/crate-python/actions/runs/3177244114/jobs/5177463683

[2022-10-03T20:30:53.977Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/)
Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
Error: Codecov: Failed to properly upload: The process '/Users/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255
Run codecov/codecov-action@v3
==> macos OS detected
https://uploader.codecov.io/latest/macos/codecov.SHA256SUM
==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (ccc032e70958ea3eca9bd15c7fdad5bbacc279c3bab22f227417573356569666  codecov)
==> Running version latest
==> Running version v0.3.2
/Users/runner/work/_actions/codecov/codecov-action/v3/dist/codecov -n  -Q github-action-3.1.1 -Z -C 6492325de0ce91500fa435a9f7e6afb27a579b2b
[2022-10-03T20:30:52.747Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.3.2
[2022-10-03T20:30:52.772Z] ['info'] => Project root located at: /Users/runner/work/crate-python/crate-python
[2022-10-03T20:30:52.778Z] ['info'] -> No token specified or token is empty
[2022-10-03T20:30:52.830Z] ['info'] Searching for coverage files...
[2022-10-03T20:30:53.501Z] ['info'] Warning: Some files located via search were excluded from upload.
[2022-10-03T20:30:53.501Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
[2022-10-03T20:30:53.502Z] ['info'] => Found 2 possible coverage files:
  coverage.xml
  .venv/bin/coverage-3.11
[2022-10-03T20:30:53.502Z] ['info'] Processing /Users/runner/work/crate-python/crate-python/coverage.xml...
[2022-10-03T20:30:53.540Z] ['info'] Processing /Users/runner/work/crate-python/crate-python/.venv/bin/coverage-3.11...
[2022-10-03T20:30:53.572Z] ['info'] Detected GitHub Actions as the CI provider.
[2022-10-03T20:30:53.574Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-3.1.1-uploader-0.3.2&token=*******&branch=amo%2Fpython311&build=3177244114&build_url=https%3A%2F%2Fgithub.com%2Fcrate%2Fcrate-python%2Factions%2Fruns%2F3177244114&commit=6492325de0ce91500fa435a9f7e6afb27a579b2b&job=Tests&pr=450&service=github-actions&slug=crate%2Fcrate-python&name=&tag=&flags=&parent=
[2022-10-03T20:30:53.977Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
Error: Codecov: Failed to properly upload: The process '/Users/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255

References

Others are observing the same issue. Apparently, https://codecov.io occasionally responds with 404 Not Found.

Debugging

Trying different approaches like 67d63cc or da27772.

Supposed solution

The patch da27772 explicitly adds the use of the with.token option, as confirmed by others to improve the behaviour even on public repos.

The token is not required for public repos, but it makes the workflow less likely to randomly fail because of a limit in codecov CI capabilities [1]. However, the secret token does not always save from erratic behaviour [2-4].

[1] codecov/codecov-action#557 (comment)
[2] codecov/codecov-action#557 (comment)
[3] codecov/codecov-action#598 (comment)
[4] https://github.com/orgs/community/discussions/25701

Still croaks

Example: https://github.com/crate/crate-python/actions/runs/3177539843/jobs/5178341299

Solution

Using cb2d904 instead now, using fail_ci_if_error: false. C'est la vie. 🌧️

amotl added a commit that referenced this pull request Oct 4, 2022
Codecov occasionally responds with:

    404 Not Found: Unable to locate build via Github Actions API.

Some workaround-like mitigations have been tried, but to no avail.

Reference: #451
@amotl amotl force-pushed the amo/fix-codecov-upload-errors branch from 79060aa to cb2d904 Compare October 4, 2022 08:56
@amotl
Copy link
Member Author

amotl commented Oct 4, 2022

@thomasrockhu / @thomasrockhu-codecov just created a tracking post on their forum at [1]. Thank you! When this is resolved, we may want to revert this patch. With f5aedc8, I am trying to explicitly configure a CODECOV_TOKEN once more, just to make sure I didn't mess up when trying with da27772.

[1] https://community.codecov.com/t/unable-to-locate-build-via-github-actions-api-for-the-public-repository/3894
[2] codecov/feedback#126

amotl added a commit that referenced this pull request Oct 4, 2022
@amotl amotl marked this pull request as draft October 4, 2022 09:17
amotl added a commit that referenced this pull request Oct 4, 2022
@amotl amotl force-pushed the amo/fix-codecov-upload-errors branch from 708d160 to f5aedc8 Compare October 4, 2022 09:21
@amotl amotl marked this pull request as ready for review October 4, 2022 11:21
@amotl
Copy link
Member Author

amotl commented Oct 4, 2022

It looks like adding CODECOV_TOKEN as an environment variable with f5aedc8 works pretty well so far.

@amotl amotl force-pushed the amo/fix-codecov-upload-errors branch from b780104 to cd1e027 Compare October 10, 2022 09:05
@amotl amotl merged commit d234128 into master Oct 10, 2022
@amotl amotl deleted the amo/fix-codecov-upload-errors branch October 10, 2022 09:29
@amotl
Copy link
Member Author

amotl commented Oct 18, 2022

Another occurrence on behalf of codecov/codecov-action#458? The error message is different.

[2022-10-18T18:08:10.081Z] ['error'] There was an error running the uploader:
Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 
503 - upstream connect error or disconnect/reset before headers. reset reason: connection failure
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255

-- https://github.com/crate/crate-python/actions/runs/3275823201/jobs/5391136840#step:5:44

@amotl
Copy link
Member Author

amotl commented Oct 18, 2022

[2022-10-18T19:57:03.064Z] ['error'] There was an error running the uploader: 
Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 500 - {"error": "Server Error (500)"}
Error: Codecov: Failed to properly upload: The process '/Users/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255

-- https://github.com/crate/crate-python/actions/runs/3276395895/jobs/5392400640#step:5:43

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