codecov / codecov-exe

.exe report uploader for Codecov https://codecov.io
MIT License
25 stars 21 forks source link

codecov.exe fails with 403 when uploading multiple .gcov files #33

Closed hhartz closed 4 years ago

hhartz commented 6 years ago

coverage data is prepared using gcov and uploaded;

  - gcov debug\*.gcno
  - ps: |
      $gcovfiles = (Get-ChildItem -Path "*.gcov").Name
      codecov -v -f $gcovfiles -t $env:CODECOV_TOKEN

In the output, the upload seems to start prematurely after it lists 410 .gcov files;

redacted.cpp.gcov
redacted.h.gcov
redacted.cpp.gcov
redacted.h.gcov
2018-01-26 13:28:10 [Information] Uploading Reports.
2018-01-26 13:28:10 [Information] url: https://codecov.io
2018-01-26 13:28:10 [Verbose] api endpoint: https://codecov.io/upload/v4?branch=master&commit=0d66dc2becbc9939389d60cdeaff76512e9bd3e2&build=3q86csgq97snqrqu&tag=&pr=1259&name=&flags=&slug=redacted%2Fredacted&token=redacted&package=exe-1.0.1&build_url=&yaml=.codecov.yml&job=redacted%2Fredacted%2F1.0.4331&service=appveyor
2018-01-26 13:28:10 [Information] query: https://codecov.io/upload/v4?branch=master&commit=0d66dc2becbc9939389d60cdeaff76512e9bd3e2&build=3q86csgq97snqrqu&tag=&pr=1259&name=&flags=&slug=redacted%2Fredacted&package=exe-1.0.1&build_url=&yaml=.codecov.yml&job=redacted%2Fredacted%2F1.0.4331&service=appveyor
2018-01-26 13:28:10 [Information] Pinging Codecov
redacted.h.gcov
redacted.cpp.gcov
redacted.cpp.gcov
redacted.cpp.gcov
redacted.h.gcov
redacted.cpp.gcov
redacted.cpp.gcov
...

finally, While checking upload status, codecov.exe fails;


...
2018-01-26 13:28:29 [Fatal] One or more errors occurred. (The remote server returned an error: (403) Forbidden.)
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Codecov.Upload.Upload.Uploader() in C:\Users\Administrator\github\codecov-exe\Source\Codecov\Upload\Upload.cs:line 60
   at Codecov.Program.UploadFacade.Uploader() in C:\Users\Administrator\github\codecov-exe\Source\Codecov\Program\UploadFacade.cs:line 119
   at Codecov.Program.Run.Runner(IEnumerable`1 args) in C:\Users\Administrator\github\codecov-exe\Source\Codecov\Program\Run.cs:line 20```
stevepeak commented 6 years ago

Thanks for submitting! It appears that this is an issue uploading to S3. From Codecov logs I see a 200 when getting the S3 upload target url.

CraigWoolgar commented 6 years ago

Hi. I had a similar problem (with pretty large XML files). I contacted Codecov support and they said adding -X s3 to the bash script will mean that the coverage is uploaded directly to Codecov and skip S3. @AdmiringWorm Is it possible that implementing a switch for this could solve the problem?

mikebro commented 6 years ago

I seem to be having the same issue as @CraigWoolgar. I didn't understand what was meant by -X s3 so I looked at some of the other codecov repos like python and node and found that it means to use v2 of the api instead of v4

mikebro commented 6 years ago

I implemented a --disable-s3 argument to use the v2 endpoint and that seems to have fixed my 403 issues. The changes aren't perfect but they're here

ViktorHofer commented 5 years ago

Could you please submit a PR to the main repo? My team is also blocked by this currently.

mikebro commented 5 years ago

I will take a look at it next week and see what I can do, from what I remember I made some changes that work for our case but maybe not all cases.

AdmiringWorm commented 5 years ago

@mikebro if you decide to open a PR for this, please target the hotfix/1.2.1 branch

ViktorHofer commented 5 years ago

I have a PR ready which is fairly big as I also noticed couple other issues in the code base. @AdmiringWorm do you have sometime this week time to quickly chat about it before I submit it? Would like to explain why I refactored much of the code. Skype/Teams/Gitter works for me.

AdmiringWorm commented 5 years ago

Sure thing, you can reach me on gitter under the same name as here on github.

I've got some time tomorrow, or on friday to talk about the changes.

BTW, I would prefer if the refactoring, and the fixing of this issue were in two separate PR's (if possible).

ViktorHofer commented 5 years ago

Kim the gitter channel linked on this repo doesn't work. Could you please contact me on my GH profile's mail address? Summarizing my changes via mail should be good enough. Thanks!

AdmiringWorm commented 5 years ago

Kim the gitter channel linked on this repo doesn't work

Oh right, completely forgot that the official codecov support channel had been shut down. I've created a new channel there now for support of codecov-exe: https://gitter.im/codecov-exe/community

I've also sent you an email.

mikebro commented 5 years ago

@ViktorHofer Should I look at implementing the disable S3 flag before your big refactor?

ViktorHofer commented 5 years ago

@mikebro thanks for offering but I think I should have my PR ready by tomorrow. I discussed with @AdmiringWorm the reasoning behind the big refactor and I think we are all on the same boat.

AdmiringWorm commented 5 years ago

A new release of codecov-exe was released just now that I believe fixes this issue as it falls back to uploading to a v2 url (instead of the normal v4 url).

If anyone are able to test out the new changes when nuget is done indexing (Version 1.6.0), I would appreciate it.

mikebro commented 5 years ago

@AdmiringWorm I tested and it does fall back to v2 after v4 fails now, I tested with v1.7.2

CraigWoolgar commented 5 years ago

@AdmiringWorm Using v1.7.2 I'm still getting a 403, and it's not reverting to the v2 endpoint. The CoverageReport.xml file is in the region of 30MB, so a bit on the chunky side.

[16:35:31][Step 1/2] 2019-10-16 16:35:31 [Information] url: https://codecov.io
[16:35:31][Step 1/2] 2019-10-16 16:35:31 [Verbose] api endpoint: https://codecov.io/upload/v4?branch=xxx&commit=xxx&build=xxx&tag=&pr=&name=&flags=&slug=xxx&token=xxx&package=exe-1.0.1&build_url=xxx&yaml=&job=&service=teamcity
[16:35:31][Step 1/2] 2019-10-16 16:35:31 [Information] query: https://codecov.io/upload/v4?branch=xxx&commit=xxx&build=xxx&tag=&pr=&name=&flags=&slug=xxx&package=exe-1.0.1&build_url=xxx&yaml=&job=&service=teamcity
[16:35:31][Step 1/2] 2019-10-16 16:35:31 [Information] Pinging Codecov
[16:36:19][Step 1/2] 2019-10-16 16:36:19 [Fatal] One or more errors occurred. (The remote server returned an error: (403) Forbidden.)
[16:36:19][Step 1/2]    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[16:36:19][Step 1/2]    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
[16:36:19][Step 1/2]    at Codecov.Upload.Upload.Uploader() in C:\Users\Administrator\github\codecov-exe\Source\Codecov\Upload\Upload.cs:line 60
[16:36:19][Step 1/2]    at Codecov.Program.UploadFacade.Uploader() in C:\Users\Administrator\github\codecov-exe\Source\Codecov\Program\UploadFacade.cs:line 119
[16:36:19][Step 1/2]    at Codecov.Program.Run.Runner(IEnumerable`1 args) in C:\Users\Administrator\github\codecov-exe\Source\Codecov\Program\Run.cs:line 20
[16:36:19][Step 1/2] Process exited with code 0
AdmiringWorm commented 5 years ago

@CraigWoolgar looking at the url codecov-exe submits to, I see that you are actually running version 1.0.1 of codecov-exe.

&package=exe-1.0.1

The above part should actually be

&package=exe-1.7.2

for the latest version.

Make sure that you don't have an older version of codecov-exe available on path that gets picked up instead of version 1.7.2