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

The uploader receives bad requests when setting CI env in GitHub actions #217

Closed
liuruenshen opened this issue Jul 17, 2021 · 5 comments
Closed
Assignees

Comments

@liuruenshen
Copy link

Describe the bug
When I run the codecov uploader in the docker container, everything is fine until I set up environment variables using the first technique mentioned in the following article:
https://docs.codecov.com/docs/testing-with-docker

Then the uploader complains about bad requests:

Detected GitHub Actions as the CI provider.
Pinging Codecov: https://codecov.io/upload/v4?package=uploader-0.1.0&token=*******&branch=test/migrate-to-shellspec&build=1039293011&build_url=undefined%2Fdustin71728%2Fyarn-2-completion%2Factions%2Fruns%2F1039293011&commit=24eb740b7574622e2af937f65c74e97292ab9448&job=default&pr=&service=github-actions&slug=dustin71728/yarn-2-completion&name=&tag=&flags=&parent=
https://codecov.io/upload/v4?package=uploader-0.1.0&branch=test/migrate-to-shellspec&build=1039293011&build_url=undefined%2Fdustin71728%2Fyarn-2-completion%2Factions%2Fruns%2F1039293011&commit=24eb740b7574622e2af937f65c74e97292ab9448&job=default&pr=&service=github-actions&slug=dustin71728/yarn-2-completion&name=&tag=&flags=&parent=
        Content-Type: 'text/plain'
        Content-Encoding: 'gzip'
        X-Reduced-Redundancy: 'false'
Error!: Error: Error uploading to https://codecov.io: Error: Error uploading to Codecov: Error: Bad Request

I wonder if the root cause is that the build_url query parameter is not a well-formatted URL. It is a literal undefined string in the host part of the URL.

So I try to set up CI_BUILD_URL with the correct value, but it still doesn't work.
The failed log( In Run yarn test step):
https://github.com/dustin71728/yarn-2-completion/runs/3091016225?check_suite_focus=true

The log printed out all the environment variables returned from the command:
"ci_env=bash <(curl -s https://codecov.io/env)"
https://github.com/dustin71728/yarn-2-completion/runs/3090999690?check_suite_focus=true

The successful log without CI environment variables involved:
https://github.com/dustin71728/yarn-2-completion/runs/3081701233?check_suite_focus=true

References
Dockerfile: https://github.com/dustin71728/yarn-2-completion/blob/test/migrate-to-shellspec/docker/bash-5-0.Dockerfile
Github Action YAML file: https://github.com/dustin71728/yarn-2-completion/blob/test/migrate-to-shellspec/.github/workflows/default.yaml

Expected behavior
The uploader should upload the coverage report when the CI is true in the docker container running on Github action.

@TriplEight
Copy link

Getting the same with

 codecov -t ******* -f lcov-lines.info -v

     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.1.0
=> Project root located at: /builds
Start of network processing...
Searching for files in /builds

....

Search complete for files in /builds
End of network processing
Processing lcov-lines.info...
Detected Local as the CI provider.
Pinging Codecov: https://codecov.io/upload/v4?package=uploader-0.1.0&token=*******&branch=master&build=&build_url=&commit=e5b400bee45556d948cf0e818f9d8ffc016fe09b&job=&pr=&service=&slug=paritytech/ink&name=&tag=&flags=&parent=
https://codecov.io/upload/v4?package=uploader-0.1.0&branch=master&build=&build_url=&commit=e5b400bee45556d948cf0e818f9d8ffc016fe09b&job=&pr=&service=&slug=paritytech/ink&name=&tag=&flags=&parent=
        Content-Type: 'text/plain'
        Content-Encoding: 'gzip'
        X-Reduced-Redundancy: 'false'
Error!: Error: Error uploading to https://codecov.io: Error: Error uploading to Codecov: Error: Bad Request

@thomasrockhu
Copy link
Contributor

@TriplEight do you mind opening a separate issue for this if you are not using GitHub Actions? I think it's a different cause, and I'd like to be able to keep track of the issues to make sure they are taken care of.

@thomasrockhu
Copy link
Contributor

@dustin71728, I made a change to the uploader, are you still experiencing the issue?

@liuruenshen
Copy link
Author

liuruenshen commented Jul 21, 2021

@thomasrockhu

Thanks for the effort, I can confirm that GITHUB_SERVER_URL is produced by curl -s https://codecov.io/env, and it solves my issue.

± |main {1} ?:3 ✗| → env GITHUB_ACTIONS=1 bash <(curl -s https://codecov.io/env)
-e CODECOV_ENV -e CODECOV_TOKEN -e CODECOV_URL -e CODECOV_SLUG -e VCS_COMMIT_ID -e VCS_BRANCH_NAME -e VCS_PULL_REQUEST -e VCS_SLUG -e VCS_TAG -e CI_BUILD_URL -e CI_BUILD_ID -e CI_JOB_ID -e GITHUB_ACTIONS -e GITHUB_HEAD_REF -e GITHUB_REF -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKFLOW 

@thomasrockhu
Copy link
Contributor

awesome @dustin71728, closing this out

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 a pull request may close this issue.

3 participants