codecov / codecov-exe

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

Slug generation is incorrect when using username and password in url. #79

Closed aelassas closed 5 years ago

aelassas commented 5 years ago

Hi,

When I try to upload my report I get the following error:

2019-07-22 08:20:59 INF Pinging Codecov
2019-07-22 08:21:02 WRN Unable to ping Codecov. Server returned: (BadRequest) Bad Request
2019-07-22 08:21:02 VRB Failed to ping codecov.
2019-07-22 08:21:02 VRB Uploader failed.
2019-07-22 08:21:02 INF Uploading to Codecov
2019-07-22 08:21:11 WRN Failed to upload the report with CodecovFallbackUploader.
2019-07-22 08:21:11 VRB Uploader failed.
2019-07-22 08:21:12 FTL Failed to upload the report.
   at Codecov.Upload.Uploads.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/Uploads.cs:line 34
   at Codecov.Program.UploadFacade.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/UploadFacade.cs:line 120
   at Codecov.Program.Run.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/Run.cs:line 67
   at Codecov.Program.Run.Runner(IEnumerable`1 args) in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/Run.cs:line 20

Can you please helpe me so I can upload my reports to codecov.io?

Kind regrads, Akram.

AdmiringWorm commented 5 years ago

How are you calling codecov-exe? What arguments to you set? Are you running on a CI server? If so, which one? Is it a git repository? Is the commit you are running on available in the remote repository? What is the version of codecov-exe that you are running?

aelassas commented 5 years ago

@AdmiringWorm

I'm using codecov.exe on windows 10 from cmd. Here is my command:

codecov.exe --required --verbose --root "D:\dev\Wexflow\src" -f "Wexflow_coverage.xml" --token myToken -n Wexflow
AdmiringWorm commented 5 years ago

@aelassas and do the commit you are running on exist in a remote git repository? and what is the version of codecov installed? (the latest right now it 1.6.1).

If the commit do exist in the remote repository, then I would need to get together a new build with some additional logging enabled to get the response body from the server (sometimes it contains clues to why it returns a bad request message). I don't have such a build ready yet though, but I will try getting one together when I get home later today.

aelassas commented 5 years ago

@AdmiringWorm Yes the commit I am running do exist in the remote git repository.

I'm using codecov.exe 1.6.1 (the latest) for Windows. I downloaded it from nuget.org.

AdmiringWorm commented 5 years ago

@aelassas I have created an edition with logging of the returned value from the server being outputted (only if the returned type is plain text).

Would you mind testing it out to see what gets reported by the server? The available artifacts for download is located here: https://ci.appveyor.com/project/AdmiringWorm/codecov-exe/build/job/e5rpyp2p3qwbkc0p/artifacts

aelassas commented 5 years ago

@AdmiringWorm I have tested the version 1.7.0 with extra logging but the problem remains. Here is the output:


              _____          _
             / ____|        | |
            | |     ___   __| | ___  ___ _____   __
            | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
            | |___| (_) | (_| |  __/ (_| (_) \ V /
             \_____\___/ \____|\___|\___\___/ \_/
                                         exe-1.7.0-extra-logging0001

2019-07-27 11:52:37 WRN No CI detected.
2019-07-27 11:52:37 INF Git detected.
2019-07-27 11:52:38 INF Project root: d:\dev\Wexflow\src
2019-07-27 11:52:38 INF Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
2019-07-27 11:52:38 INF Reading reports.
2019-07-27 11:52:38 INF Wexflow_coverage.xml
2019-07-27 11:52:38 INF Uploading Reports.
2019-07-27 11:52:40 INF url: https://codecov.io
2019-07-27 11:52:43 INF query: https://codecov.io/upload/v4?branch=master&commit=ddec1f190a2b637809170142a30e8b6a46f558ca&build=&tag=&pr=&name=Wexflow&flags=&slug=%2Faelassas&package=exe-1.7.0-extra-logging0001&build_url=&yaml=&job=&service=
2019-07-27 11:52:44 INF Pinging Codecov
2019-07-27 11:52:45 WRN Unable to ping Codecov. Server returned: (400) Bad Request
2019-07-27 11:52:45 WRN Unknown reason. Possible reason being invalid parameters.
2019-07-27 11:52:45 INF Uploading to Codecov
2019-07-27 11:52:53 WRN Unable to upload coverage report to Codecov. Server returned: (400) Bad Request
2019-07-27 11:52:53 WRN HTTP 400
slug must match pattern ^[\w\-\.\~\/]+\/[\w\-\.]{1,255}$

2019-07-27 11:52:53 WRN Failed to upload the report with CodecovFallbackUploader.
2019-07-27 11:52:53 FTL Failed to upload the report.
   at Codecov.Upload.Uploads.Uploader() in C:\projects\codecov-exe\Source\Codecov\Upload\Uploads.cs:line 34
   at Codecov.Program.UploadFacade.Uploader() in C:\projects\codecov-exe\Source\Codecov\Program\UploadFacade.cs:line 120
   at Codecov.Program.Run.Uploader() in C:\projects\codecov-exe\Source\Codecov\Program\Run.cs:line 67
   at Codecov.Program.Run.Runner(IEnumerable`1 args) in C:\projects\codecov-exe\Source\Codecov\Program\Run.cs:line 20

I am using codecov-windows-x64.exe from a command line in Windows 10 x64.

And below is the command I am using:

codecov.exe -f "Wexflow_coverage.xml" -t my-token -n Wexflow

And I also tested the following command:

codecov.exe --required --verbose --root "D:\dev\Wexflow\src" -f "Wexflow_coverage.xml" --token my-token -n Wexflow
AdmiringWorm commented 5 years ago

hmm, looks like there is a problem with the generation of the slug (so this fails the validation upstream).

Try specifying it manually with the --slug argument (format of the slug should be repositoryOwner/repositorName), you can also set the CODECOV_SLUG environment variable if you prefer it that way.

AdmiringWorm commented 5 years ago

Just trying to figure out why it gets the wrong url. Would you mind showing the output of the following commond (assuming it isn't for a private repository): git config --get remote.origin.url.

That command is what we are using to generate the slug.

AdmiringWorm commented 5 years ago

I am almost certain that you maybe have a trailing slash on the outputted url, or it contains a slash right after a second one. But want to make sure that is the problem before figuring out a fix.

aelassas commented 5 years ago

With --slug aelassas/Wexflow option, it works fine.

Here is the result of the command git config --get remote.origin.url:

https://aelassas:myPassword@github.com/aelassas/Wexflow.git
AdmiringWorm commented 5 years ago

Thank you, I have figured out why it is failing now. I will get out a new release during this weekend with the extra response logging and a the fix for this issue.

AdmiringWorm commented 5 years ago

:tada: This issue has been resolved in version 1.7.0 :tada:

The release is available on:

aelassas commented 5 years ago

When I try to upload with this new version using the command:

codecov.exe --required --verbose --root "D:\dev\Wexflow\src" -f "Wexflow_coverage.xml" --token myToken -n Wexflow

I get the following error;

              _____          _
             / ____|        | |
            | |     ___   __| | ___  ___ _____   __
            | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
            | |___| (_) | (_| |  __/ (_| (_) \ V /
             \_____\___/ \____|\___|\___\___/ \_/
                                         exe-1.7.0

2019-07-28 10:43:33 WRN No CI detected.
2019-07-28 10:43:34 INF Git detected.
2019-07-28 10:43:34 INF Project root: D:\dev\Wexflow\src
2019-07-28 10:43:35 INF Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
2019-07-28 10:43:35 INF Reading reports.
2019-07-28 10:43:35 INF Wexflow_coverage.xml
2019-07-28 10:43:35 INF Uploading Reports.
2019-07-28 10:43:37 INF url: https://codecov.io
2019-07-28 10:43:38 VRB api endpoint: https://codecov.io/upload/v4?branch=master&commit=e917efe4a437ecd7365be32c3c20884272cf12ad&build=&tag=&pr=&name=Wexflow&flags=&slug=aelassas%2FWexflow&token=myToken&package=exe-1.7.0&build_url=&yaml=&job=&service=
2019-07-28 10:43:39 INF query: https://codecov.io/upload/v4?branch=master&commit=e917efe4a437ecd7365be32c3c20884272cf12ad&build=&tag=&pr=&name=Wexflow&flags=&slug=aelassas%2FWexflow&package=exe-1.7.0&build_url=&yaml=&job=&service=
2019-07-28 10:43:40 VRB Trying to upload using HttpClient
2019-07-28 10:43:40 INF Pinging Codecov
2019-07-28 10:43:42 INF Uploading
2019-07-28 10:44:03 VRB One or more errors occurred. (Error while copying content to a stream.)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Codecov.Upload.CodecovUploader.CreateResponse(HttpRequestMessage request) in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/CodecovUploader.cs:line 56
   at Codecov.Upload.CodecovUploader.Put(Uri url) in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/CodecovUploader.cs:line 94
   at Codecov.Upload.Upload.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/Upload.cs:line 36
2019-07-28 10:44:03 VRB Uploader failed.
2019-07-28 10:44:03 INF Uploading to Codecov
2019-07-28 10:45:43 VRB One or more errors occurred. (A task was canceled.)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Codecov.Upload.CodecovUploader.CreateResponse(HttpRequestMessage request) in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/CodecovUploader.cs:line 56
   at Codecov.Upload.CodecovFallbackUploader.Put(Uri url) in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/CodecovFallbackUploader.cs:line 37
   at Codecov.Upload.Upload.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/Upload.cs:line 36
2019-07-28 10:45:43 VRB Uploader failed.
2019-07-28 10:45:43 FTL Failed to upload the report.
   at Codecov.Upload.Uploads.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/Uploads.cs:line 34
   at Codecov.Program.UploadFacade.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/UploadFacade.cs:line 120
   at Codecov.Program.Run.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/Run.cs:line 67
   at Codecov.Program.Run.Runner(IEnumerable`1 args) in /home/appveyor/projects/codecov-exe/Source/Codecov/Program/Run.cs:line 20

But when I try to upload using --slug:

codecov.exe --required --slug aelassas/Wexflow --verbose --root "D:\dev\Wexflow\src" -f "Wexflow_coverage.xml" --token myToken -n Wexflow

It succeeds after an error:

              _____          _
             / ____|        | |
            | |     ___   __| | ___  ___ _____   __
            | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
            | |___| (_) | (_| |  __/ (_| (_) \ V /
             \_____\___/ \____|\___|\___\___/ \_/
                                         exe-1.7.0

2019-07-28 10:45:57 WRN No CI detected.
2019-07-28 10:45:57 INF Git detected.
2019-07-28 10:45:57 INF Project root: D:\dev\Wexflow\src
2019-07-28 10:45:57 INF Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
2019-07-28 10:45:57 INF Reading reports.
2019-07-28 10:45:57 INF Wexflow_coverage.xml
2019-07-28 10:45:57 INF Uploading Reports.
2019-07-28 10:45:58 INF url: https://codecov.io
2019-07-28 10:45:59 VRB api endpoint: https://codecov.io/upload/v4?branch=master&commit=e917efe4a437ecd7365be32c3c20884272cf12ad&build=&tag=&pr=&name=Wexflow&flags=&slug=aelassas%2FWexflow&token=myToken&package=exe-1.7.0&build_url=&yaml=&job=&service=
2019-07-28 10:45:59 INF query: https://codecov.io/upload/v4?branch=master&commit=e917efe4a437ecd7365be32c3c20884272cf12ad&build=&tag=&pr=&name=Wexflow&flags=&slug=aelassas%2FWexflow&package=exe-1.7.0&build_url=&yaml=&job=&service=
2019-07-28 10:46:00 VRB Trying to upload using HttpClient
2019-07-28 10:46:00 INF Pinging Codecov
2019-07-28 10:46:01 INF Uploading
2019-07-28 10:46:30 VRB One or more errors occurred. (Error while copying content to a stream.)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Codecov.Upload.CodecovUploader.CreateResponse(HttpRequestMessage request) in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/CodecovUploader.cs:line 56
   at Codecov.Upload.CodecovUploader.Put(Uri url) in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/CodecovUploader.cs:line 94
   at Codecov.Upload.Upload.Uploader() in /home/appveyor/projects/codecov-exe/Source/Codecov/Upload/Upload.cs:line 36
2019-07-28 10:46:30 VRB Uploader failed.
2019-07-28 10:46:30 INF Uploading to Codecov
2019-07-28 10:47:24 INF View reports at: https://codecov.io/github/aelassas/Wexflow/commit/e917efe4a437ecd7365be32c3c20884272cf12ad
2019-07-28 10:47:24 VRB response: https://codecov.io/upload/v2?branch=master&commit=e917efe4a437ecd7365be32c3c20884272cf12ad&build=&tag=&pr=&name=Wexflow&flags=&slug=aelassas%2FWexflow&token=70fc9dbc-b291-4fd9-8991-0b2316cff8d7&package=exe-1.7.0&build_url=&yaml=&job=&service=
AdmiringWorm commented 5 years ago

@aelassas would you mind opening a new issue for this, although it seems to be related I do believe this is something else entirely.

aelassas commented 5 years ago

@AdmiringWorm done.

AdmiringWorm commented 5 years ago

Thank you.