Public repositories can no longer upload coverage with error "Unable to locate build via Azure API."

Description

I’m seeing this in multiple repos. Public repository can no longer upload coverage with error:

{‘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’)}

Commit SHAs

SHA: 302e3ce31ca7b3eb19bc54a493b8749333b049df

Repository

PR: https://github.com/dsccommunity/SqlServerDsc/pull/1696

CI/CD or Build URL

Azure Pipelines
https://dev.azure.com/dsccommunity/SqlServerDsc/_build/results?buildId=5107&view=logs&j=9c98dabf-a506-5435-4ead-dace7c1625a8&t=c251aece-c156-5cd3-dcec-645d5e596fc0&l=47

Uploader

Bash-1.0.6

Codecov Output

2021-09-28T09:57:15.2663628Z ##[section]Starting: Publish Code Coverage to Codecov.io
2021-09-28T09:57:15.2670400Z ==============================================================================
2021-09-28T09:57:15.2670673Z Task         : Command line
2021-09-28T09:57:15.2671106Z Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2021-09-28T09:57:15.2671380Z Version      : 2.182.0
2021-09-28T09:57:15.2671747Z Author       : Microsoft Corporation
2021-09-28T09:57:15.2672421Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2021-09-28T09:57:15.2672922Z ==============================================================================
2021-09-28T09:57:15.4022694Z Generating script.
2021-09-28T09:57:15.4035651Z Script contents:
2021-09-28T09:57:15.4036462Z bash <(curl -s https://codecov.io/bash) -f "./output/testResults/JaCoCo_coverage.xml" -F unit
2021-09-28T09:57:15.4038832Z ========================== Starting Command Output ===========================
2021-09-28T09:57:15.4084421Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/4f59f332-270c-482f-9297-a68fb69bb1dc.sh
2021-09-28T09:57:15.6060991Z 
2021-09-28T09:57:15.6062164Z   _____          _
2021-09-28T09:57:15.6062653Z  / ____|        | |
2021-09-28T09:57:15.6063117Z | |     ___   __| | ___  ___ _____   __
2021-09-28T09:57:15.6063641Z | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
2021-09-28T09:57:15.6064105Z | |___| (_) | (_| |  __/ (_| (_) \ V /
2021-09-28T09:57:15.6064544Z  \_____\___/ \__,_|\___|\___\___/ \_/
2021-09-28T09:57:15.6065984Z                               Bash-1.0.6
2021-09-28T09:57:15.6066380Z 
2021-09-28T09:57:15.6066650Z 
2021-09-28T09:57:15.6088082Z e[0;36m==>e[0m git version 2.31.1 found
2021-09-28T09:57:15.6155085Z e[0;36m==>e[0m curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
2021-09-28T09:57:15.6156162Z Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
2021-09-28T09:57:15.6157076Z Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets 
2021-09-28T09:57:15.6251306Z e[0;90m==>e[0m Azure Pipelines detected.
2021-09-28T09:57:15.6372096Z     Fixing merge commit SHA e032570b0da0a5ab4b49206f78296950ece71d79 -> 302e3ce31ca7b3eb19bc54a493b8749333b049df
2021-09-28T09:57:15.6373147Z     e[0;90mcurrent dir: e[0m /home/vsts/work/1/s
2021-09-28T09:57:15.6373881Z     e[0;90mproject root:e[0m .
2021-09-28T09:57:15.6558564Z     e[0;90mYaml found at:e[0m codecov.yml
2021-09-28T09:57:15.6998748Z     e[0;90m->e[0m Found 1 reports
2021-09-28T09:57:15.7011823Z e[0;90m==>e[0m Detecting git/mercurial file structure
2021-09-28T09:57:15.7115084Z e[0;90m==>e[0m Reading reports
2021-09-28T09:57:15.7170431Z     e[0;32m+e[0m ./output/testResults/JaCoCo_coverage.xml e[0;90mbytes=391409e[0m
2021-09-28T09:57:15.7225752Z e[0;90m==>e[0m Appending adjustments
2021-09-28T09:57:15.7226778Z     e[0;36mhttps://docs.codecov.io/docs/fixing-reportse[0m
2021-09-28T09:57:15.7327834Z     e[0;90m->e[0m No adjustments found
2021-09-28T09:57:15.7354716Z e[0;90m==>e[0m Gzipping contents
2021-09-28T09:57:15.7819097Z         28K	/tmp/codecov.6HkTBS.gz
2021-09-28T09:57:15.7838470Z e[0;90m==>e[0m Uploading reports
2021-09-28T09:57:15.7838960Z     e[0;90murl:e[0m https://codecov.io
2021-09-28T09:57:15.7840232Z     e[0;90mquery:e[0m branch=refs%2Fpull%2F1696%2Fmerge&commit=302e3ce31ca7b3eb19bc54a493b8749333b049df&build=15.2.1-PR1696.7&build_url=https%3A%2F%2Fdev.azure.com%2Fdsccommunity%2FSqlServerDsc%2F_build%2Fresults%3FbuildId%3D5107&name=&tag=&slug=dsccommunity%2FSqlServerDsc&service=azure_pipelines&flags=unit&pr=1696&job=5107&cmd_args=f,F&project=SqlServerDsc&server_uri=https://dev.azure.com/dsccommunity/
2021-09-28T09:57:15.7872477Z e[0;90m->e[0m  Pinging Codecov
2021-09-28T09:57:15.7874614Z https://codecov.io/upload/v4?package=bash-1.0.6&token=<hidden>&package=bash-1.0.6&token=&branch=refs%2Fpull%2F1696%2Fmerge&commit=302e3ce31ca7b3eb19bc54a493b8749333b049df&build=15.2.1-PR1696.7&build_url=https%3A%2F%2Fdev.azure.com%2Fdsccommunity%2FSqlServerDsc%2F_build%2Fresults%3FbuildId%3D5107&name=&tag=&slug=dsccommunity%2FSqlServerDsc&service=azure_pipelines&flags=unit&pr=1696&job=5107&cmd_args=f,F&project=SqlServerDsc&server_uri=https://dev.azure.com/dsccommunity/
2021-09-28T09:57:16.0844927Z e[0;31m{'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-09-28T09:57:16.0846000Z 404e[0m
2021-09-28T09:57:16.0846679Z e[0;90m==>e[0m Uploading to Codecov
2021-09-28T09:57:16.0915243Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2021-09-28T09:57:16.0916693Z                                  Dload  Upload   Total   Spent    Left  Speed
2021-09-28T09:57:16.0917409Z 
2021-09-28T09:57:16.3726022Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2021-09-28T09:57:16.3727555Z 100 26555  100   189  100 26366    670  93519 --:--:-- --:--:-- --:--:-- 93829
2021-09-28T09:57:16.3860926Z     e[0;32m{'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')}e[0m
2021-09-28T09:57:16.3927913Z ##[section]Finishing: Publish Code Coverage to Codecov.io

Expected Results

Coverage to be uploaded as it always have to public repos without providing a token.

Actual Results

Coverage upload fail.

Additional Information

Not at this time. Please tag me if ypu want me to test something.

@johlju the bash uploader is being deprecated, would you be able to see if the issue continues with our new uploader

I will test the new uploader as soon as I can. I had to go out of town, but will report back as soon as possible.

We are running into the same issue with the new uploader. Here is an example log: https://dev.azure.com/mdolab/Public/_build/results?buildId=2315&view=logs&j=008c1c60-593d-5c43-72f9-a33900ae6572&t=762b036c-c79c-5303-ecee-99e8dd294175

I am also experiencing this issue. Originally I thought this was due to the fact that we were using the deprecated bash uploader, so I moved to using the new uploader and am getting the exact same error. This seems like a problem with the API, not with the client application.

I opened an issue with the new uploader since I originally thought it was a bug in the client. When I reviewed the logs from our jobs using the bash uploader, the error is the same.

In my testing, I found that setting the token is necessary to make the upload work.

It seems like something may have changed in the Codecov API that is no longer parsing the POST data from jobs run in Azure Pipelines correctly.

I have not tested on other CI platforms to see if there are similar issues uploading public projects without specifying a token.

Today two repos uploaded the code coverage again. @tom was it a change on your side?

@johlju yes, we made a change on Friday that fixed an issue with Azure. Are you still seeing an issue?

cc: @sseraj @samdoran

Yesterday two repos uploaded correctly again using the bash uploader.

I have not verified that the new uploader works since I haven’t yet have time to switched uploader in a repo. Assuming other people will confirm that the new uploader works too.

For me I’m happy to close this.

Unfortunately, we are now seeing a different error:

[2021-10-11T16:05:28.238Z] ['error'] Error POSTing to https://codecov.io: 500 {"error": "Server Error (500)"}
[2021-10-11T16:05:28.238Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: Internal Server Error

Here is the full log:
https://dev.azure.com/mdolab/Public/_build/results?buildId=2363&view=logs&j=6e36574e-272e-5cfd-db05-d4dd46f7a3d9&t=7bfaaf13-9e9b-522f-065b-e7d24d42100a

Our nightly builds that upload coverage reports using the bash uploader started working again after the server side change made on Friday.

I am still doing some testing with the new uploader. I, too, saw that 500 error on Friday when I was testing.

Currently the bash uploader is working properly, but it appears like the new uploader only works from Azure Pipelines if a token is supplied. If no token is supplied, I see a 500 error with the new uploader.

I’m trying with a token with the new uploader to see if that works.

The new uploader works if I supply the token. This seems like a regression since the bash uploader doesn’t require the token for public projects.


After doing more testing and a hint from @drazisil, the slug is all that is needed. The bash uploader used to provide the slug, so I open a PR to always add the slug.

1 Like

@johlju @samdoran I have patched the new uploader for public projects. It should not need the token. Would you be able to see if this has fixed your issues?

The issue has been resolved on our end. Thanks @samdoran for the patch!

1 Like

I’ll kick off another run using the new version of the new uploader.

Looks like things work as expected with the new uploader. :confetti_ball:

1 Like