uploader: [CODE-842] Uploader fails from public project in Azure Pipelines without token
Describe the bug When running the uploader from Azure Pipelines on a public project, the uploader fails to upload reports unless the token is set.
To Reproduce Steps to reproduce the behavior:
- Run
coverage -f [file] -n [name]
from a public project in Azure Pipelines with no token specified
Expected behavior The coverage report is uploaded successfully.
Actual behavior The provider is correctly detected but upload of coverage files fails.
Failed job output
Codecov report uploader 0.1.5
[2021-10-07T16:12:57.708Z] ['info'] => Project root located at: /__w/2/ansible
[2021-10-07T16:12:57.709Z] ['info'] -> No token specified or token is empty
[2021-10-07T16:12:57.717Z] ['info'] Searching for coverage files...
[2021-10-07T16:12:57.909Z] ['info'] => Found 1 possible coverage files:
test/results/reports/coverage-powershell.xml
[2021-10-07T16:12:57.909Z] ['info'] Processing /__w/2/ansible/test/results/reports/coverage-powershell.xml...
[2021-10-07T16:12:57.920Z] ['info'] Detected Azure Pipelines as the CI provider.
[2021-10-07T16:12:57.927Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=uploader-0.1.5&token=*******&branch=refs%2Fpull%2F75938%2Fmerge&build=20211007.20&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D26615&commit=c6ead33f8e802d1a3912a982e703f675ae188fae&job=26615&pr=75938&project=ansible&server_uri=https%3A%2F%2Fdev.azure.com%2Fansible%2F&service=azure_pipelines&slug=&name=coverage-powershell&tag=&flags=&parent=
[2021-10-07T16:12:58.327Z] ['error'] Error POSTing to https://codecov.io: 404 {'detail': ErrorDetail(string='Unable to locate build via Azure API. Project is likely private, please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
[2021-10-07T16:12:58.327Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: Not Found
[2021-10-07T16:12:58.524Z] ['info']
Additional context
The bash
uploader worked without specifying a token but the new uploader does not.
I am currently experimenting to see if setting just the slug, not the token, is sufficient. It looks curious that the slug is blank (exploded for legibility):
https://codecov.io/upload/v4?package=uploader-0.1.5
&token=*******
&branch=refs%2Fpull%2F75938%2Fmerge
&build=20211007.20
&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D26615
&commit=c6ead33f8e802d1a3912a982e703f675ae188fae
&job=26615
&pr=75938
&project=ansible
&server_uri=https%3A%2F%2Fdev.azure.com%2Fansible%2F
&service=azure_pipelines
&slug=
&name=coverage-powershell
&tag=
&flags=
&parent=
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (19 by maintainers)
Confirmed that specifying the slug works. I’ll open a PR that sets the slug for AZP.
Ah, bash is sending the slug., uploader is not. @mitchell-codecov
My simple test repo succeeds now. I will kick off a run on our main repo (that takes ~45 minutes).
Looks like we have a bug in the login that detects if the response to thhe API call is JSON or not. Investigating.