Get Codecov uploader working with local environment

Hi,

I’m trying to use the new Codecov uploader to upload coverage run for a Python codebase running within Heroku CI. Since it’s not in GitHub Actions, it fails to retrieve the commit hash. We don’t use self-hosted enterprise so don’t have a slug.

This is the output:


Codecov report uploader 0.1.0

631[2021-09-27T15:23:14.855Z] [‘info’] => Project root located at: /app

632[2021-09-27T15:23:14.856Z] [‘info’] → Token found by arguments

633[2021-09-27T15:23:15.034Z] [‘info’] Searching for coverage files…

634[2021-09-27T15:23:15.298Z] [‘info’] => Found 1 possible coverage files:

635 coverage.xml

636[2021-09-27T15:23:15.298Z] [‘info’] Processing /app/coverage.xml…

637[2021-09-27T15:23:15.316Z] [‘info’] Detected Local as the CI provider.

638[2021-09-27T15:23:15.332Z] [‘error’] There was an error running the uploader:

639Unable to detect service, please specify sha and slug manually.

640You can do this by passing the values with the -S and -r flags.

641See the -h flag for more details.

642-----> test command cd tests && bash run_tests.sh completed successfully


Here is my run command:


./codecov -R /app -N $HEROKU_TEST_RUN_COMMIT_VERSION -t ${CODECOV_TOKEN} -c -F webserver


I tried with flag -N, -S, -C. The error message says to use -S, but the documentation mentions -C and -N. How do I get it to recognize the commit SHA and ignore the slug? I verified that the Heroku environment variable does contain the commit sha.

@phosphene slug is the git repository slug e.g. codecov/uploader for https://github.com/codecov/uploader.

Cheers, I’ll give this a try – it’d be good to update the documentation, the -S flag doesn’t seem to exist and the slug is defined in the documentation as some enterprise-only feature

@philippemnoel yeah it’s indeed strange. It should have default values, but I’m not sure why you are getting errors here. Do you mind running in verbose mode and sharing the output? We could fix it with the -S, but I think I’d rather patch the uploader instead.