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

[CODE-842] Uploader fails from public project in Azure Pipelines without token #421

Closed
samdoran opened this issue Oct 7, 2021 · 19 comments · Fixed by #426
Closed

[CODE-842] Uploader fails from public project in Azure Pipelines without token #421

samdoran opened this issue Oct 7, 2021 · 19 comments · Fixed by #426
Assignees
Labels
bug Something isn't working server-side The issue is on the backend.

Comments

@samdoran
Copy link
Contributor

samdoran commented Oct 7, 2021

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:

  1. 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=
@samdoran samdoran changed the title Uploader fails to upload reports from public project in Azure Pipelines without token Uploader fails from public project in Azure Pipelines without token Oct 7, 2021
@samdoran
Copy link
Contributor Author

samdoran commented Oct 7, 2021

Setting the slug still resulted in failure. Maybe the issue is something with the Codecov API not parsing the build URL correctly? Just a wild guess based on the error, which seems like it is coming from the API and not from the client.

@samdoran
Copy link
Contributor Author

samdoran commented Oct 8, 2021

Looking into this further, it appears the bash uploader is having the same issue.

Same failure from the bash uploader
  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.2


==> git version 2.25.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> Azure Pipelines detected.
    project root: .
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + test/results/reports/coverage-powershell.xml bytes=218161
==> Gzipping contents
        40K	/tmp/codecov.8y9dR6.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=devel&commit=5cb1210f82fbfa80d3b0843050ba0086205256a0&build=20211008.46&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D26736&name=coverage-powershell&tag=&slug=ansible%2Fansible&service=azure_pipelines&flags=&pr=&job=26736&cmd_args=f,n,X,X,X,X,X&project=ansible&server_uri=https://dev.azure.com/ansible/
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.2&token=secret&branch=devel&commit=5cb1210f82fbfa80d3b0843050ba0086205256a0&build=20211008.46&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D26736&name=coverage-powershell&tag=&slug=ansible%2Fansible&service=azure_pipelines&flags=&pr=&job=26736&cmd_args=f,n,X,X,X,X,X&project=ansible&server_uri=https://dev.azure.com/ansible/
{'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')}
404

@drazisil-codecov
Copy link
Contributor

Hi @samdoran ,

Is your Azure instance private? We can't access the API needed for tokenless in that case, which is usually why we say you need a token.

@samdoran
Copy link
Contributor Author

samdoran commented Oct 8, 2021

Nope, it's public

@drazisil-codecov
Copy link
Contributor

Nope, it's public

Looks like we have a bug in the login that detects if the response to thhe API call is JSON or not. Investigating.

@drazisil-codecov drazisil-codecov self-assigned this Oct 8, 2021
@drazisil-codecov drazisil-codecov added bug Something isn't working server-side The issue is on the backend. labels Oct 8, 2021
@drazisil-codecov drazisil-codecov changed the title Uploader fails from public project in Azure Pipelines without token CODE-842 Uploader fails from public project in Azure Pipelines without token Oct 8, 2021
@drazisil-codecov drazisil-codecov changed the title CODE-842 Uploader fails from public project in Azure Pipelines without token [CODE-842] Uploader fails from public project in Azure Pipelines without token Oct 8, 2021
@drazisil-codecov
Copy link
Contributor

@samdoran Can you test if this is still an issue? It should be fixed now.

@samdoran
Copy link
Contributor Author

samdoran commented Oct 8, 2021

Sure thing!

@samdoran
Copy link
Contributor Author

samdoran commented Oct 8, 2021

My simple test repo succeeds now. I will kick off a run on our main repo (that takes ~45 minutes).

@samdoran
Copy link
Contributor Author

samdoran commented Oct 8, 2021

I'm seeing a different error now on our main repo: 500 {"error": "Server Error (500)"} . I ran it twice and got the same error each time.

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

  Codecov report uploader 0.1.5
[2021-10-08T20:57:53.112Z] ['info'] => Project root located at: /__w/1/ansible
[2021-10-08T20:57:53.113Z] ['info'] -> No token specified or token is empty
[2021-10-08T20:57:53.121Z] ['info'] Searching for coverage files...
[2021-10-08T20:57:53.306Z] ['info'] => Found 1 possible coverage files:
  test/results/reports/coverage=stub-01-powershell.xml
[2021-10-08T20:57:53.306Z] ['info'] Processing /__w/1/ansible/test/results/reports/coverage=stub-01-powershell.xml...
[2021-10-08T20:57:53.320Z] ['info'] Detected Azure Pipelines as the CI provider.
[2021-10-08T20:57:53.328Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=uploader-0.1.5&token=*******&branch=refs%2Fpull%2F75938%2Fmerge&build=20211008.85&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D26819&commit=10cccfc4c08f90540dbdcd617a00b8dae2be3905&job=26819&pr=75938&project=ansible&server_uri=https%3A%2F%2Fdev.azure.com%2Fansible%2F&service=azure_pipelines&slug=&name=stub-01-powershell&tag=&flags=&parent=
[2021-10-08T20:57:54.733Z] ['error'] Error POSTing to https://codecov.io: 500 {"error": "Server Error (500)"}
[2021-10-08T20:57:54.733Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: Internal Server Error
[2021-10-08T20:57:54.932Z] ['info']

@drazisil-codecov
Copy link
Contributor

Goodie. Let me see what the server says.

@drazisil-codecov
Copy link
Contributor

@samdoran Does it still work with a token?

@samdoran
Copy link
Contributor Author

It's been a Monday 😖. I'm just now getting to testing this. I'll report back with what I find.

@samdoran
Copy link
Contributor Author

Uploads using the bash uploader started working again with the server side change (first time they have worked in about three weeks, which we assumed was due to the bash uploader being deprecated). I kicked off another full run with the token set using the new uploader. I'll let you know how that goes.

@samdoran
Copy link
Contributor Author

Uploading using the new uploader with the token does work. I would rather not have to specify the token for the new uploader, though.

@samdoran
Copy link
Contributor Author

I just tested again (because why not 😁) and I get a 500 error with the new uploader if the token is not supplied.

  Codecov report uploader 0.1.5
[2021-10-11T20:48:51.863Z] ['info'] => Project root located at: /__w/1/ansible
[2021-10-11T20:48:51.864Z] ['info'] -> No token specified or token is empty
[2021-10-11T20:48:51.872Z] ['info'] Searching for coverage files...
[2021-10-11T20:48:52.056Z] ['info'] => Found 1 possible coverage files:
  test/results/reports/coverage-powershell.xml
[2021-10-11T20:48:52.057Z] ['info'] Processing /__w/1/ansible/test/results/reports/coverage-powershell.xml...
[2021-10-11T20:48:52.068Z] ['info'] Detected Azure Pipelines as the CI provider.
[2021-10-11T20:48:52.076Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=uploader-0.1.5&token=*******&branch=refs%2Fpull%2F75938%2Fmerge&build=20211011.52&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D27007&commit=dfaa81f304aa46b130d9d22603d4f31bb3936f6d&job=27007&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-11T20:48:53.064Z] ['error'] Error POSTing to https://codecov.io: 500 {"error": "Server Error (500)"}
[2021-10-11T20:48:53.065Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: Internal Server Error
[2021-10-11T20:48:53.259Z] ['info'] 

@drazisil-codecov
Copy link
Contributor

@samdoran It looks like Azure tokenless possibly never worked. Can you test if it works with tokenless if you pass a slug value?

@samdoran
Copy link
Contributor Author

samdoran commented Oct 12, 2021

Azure Pipelines currently works tokenless using the bash uploader (since server side changes were made last Friday).

Successful upload using the bash uploader with no token

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


==> git version 2.25.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> Azure Pipelines detected.
    project root: .
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + test/results/reports/coverage-powershell.xml bytes=217944
==> Gzipping contents
        40K	/tmp/codecov.zqALT7.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=devel&commit=afbef70bad14d4b9dfe0ea74ea1fec956710221d&build=20211012.7&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D27043&name=coverage-powershell&tag=&slug=ansible%2Fansible&service=azure_pipelines&flags=&pr=&job=27043&cmd_args=f,n,X,X,X,X,X&project=ansible&server_uri=https://dev.azure.com/ansible/
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.2&token=secret&branch=devel&commit=afbef70bad14d4b9dfe0ea74ea1fec956710221d&build=20211012.7&build_url=https%3A%2F%2Fdev.azure.com%2Fansible%2Fansible%2F_build%2Fresults%3FbuildId%3D27043&name=coverage-powershell&tag=&slug=ansible%2Fansible&service=azure_pipelines&flags=&pr=&job=27043&cmd_args=f,n,X,X,X,X,X&project=ansible&server_uri=https://dev.azure.com/ansible/
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-10-12/FDA738A7E0B7F30782ACF8100ADF5334/afbef70bad14d4b9dfe0ea74ea1fec956710221d/6e7a31e3-8937-4258-a605-ef63cba31859.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EKKHVKCKHW7KBCGM7IHR55T63V2PAVJWLVFNITJHDU5G6R5IRN3LMWJA%2F20211012%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20211012T074659Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=28b26cee507119ebfe9a2d5f543268431a2fdd979a4e5ee759ef9c5f810d8639
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 37054    0     0  100 37054      0   256k --:--:-- --:--:-- --:--:--  256k
    -> Reports have been successfully queued for processing at https://codecov.io/github/ansible/ansible/commit/afbef70bad14d4b9dfe0ea74ea1fec956710221d

I will test the new uploader providing a slug and no token.

Thank you for all your help!

@drazisil-codecov
Copy link
Contributor

Ah, bash is sending the slug., uploader is not. @mitchell-codecov

@samdoran
Copy link
Contributor Author

Confirmed that specifying the slug works. I'll open a PR that sets the slug for AZP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server-side The issue is on the backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants