Bash uploader returns error code on appveyor

Description

I’m using the bash uploader on appveyor to upload coverage reports in cobertura format and although it seems to succeed it returns an error code making the CI job fail

Repository

CI/CD

Appveyor: https://ci.appveyor.com/project/Flamefire/nowide-fr98b/build/job/5s7ksf6mbytxsykk

Uploader

Bash upload form within a PowerShell

Commit SHAs

49ee87bc7abe98503dcccb79a1f9af7b56e6eb4e

Codecov YAML

codecov:
  max_report_age: off
  require_ci_to_pass: yes
  notify:
    after_n_builds: 2
    wait_for_ci: yes
comment:
  layout: "diff, files"
ignore:
  - "test/test.hpp"

Codecov Output

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-20200629-ffaf297
==> Appveyor CI detected.
    project root: C:/projects/nowide-fr98b
    Fixing merge commit SHA
    Yaml found at: codecov.yml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Appending build variables
    + APPVEYOR_BUILD_WORKER_IMAGE
==> Reading reports
    + cobertura.xml bytes=321895
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    + Found adjustments
==> Gzipping contents
==> Uploading reports
    url: https://codecov.io
    query: branch=develop&commit=49ee87bc7abe98503dcccb79a1f9af7b56e6eb4e&build=5s7ksf6mbytxsykk&build_url=https%3A%2F%2Fci.appveyor.com%2Fproject%2Fboostorg%2Fnowide%2Fbuilds%2F33854089%2Fjob%2F5s7ksf6mbytxsykk&name=Appveyor&tag=&slug=boostorg%2Fnowide&service=appveyor&flags=&pr=110&job=Flamefire%2Fnowide-fr98b%2F1.0.600-develop
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-20200629-ffaf297&token=secret&branch=develop&commit=49ee87bc7abe98503dcccb79a1f9af7b56e6eb4e&build=5s7ksf6mbytxsykk&build_url=https%3A%2F%2Fci.appveyor.com%2Fproject%2Fboostorg%2Fnowide%2Fbuilds%2F33854089%2Fjob%2F5s7ksf6mbytxsykk&name=Appveyor&tag=&slug=boostorg%2Fnowide&service=appveyor&flags=&pr=110&job=Flamefire%2Fnowide-fr98b%2F1.0.600-develop
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2020-07-01/8E1BADE9769E504B2F71449D36F4269F/49ee87bc7abe98503dcccb79a1f9af7b56e6eb4e/2766050e-dc71-4bfe-9357-31072e4985be.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EQX6OZVJGHKK3633AAFGLBUCOOATRACRQRQF6HMSMLYUP6EAD6XSWAAY%2F20200701%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20200701T183936Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=a48c7a273a98c0ac916efe20586b7a8689adde848b3e71285ae17449bee3a3e2
bash :   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
At line:7 char:3
+   bash codecov.sh -f cobertura.xml -n Appveyor -e APPVEYOR_BUILD_WORK ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (  % Total    % ...  Time  Current:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 12280    0     0  100 12280      0  50954 --:--:-- --:--:-- --:--:-- 50954
    -> View reports at https://codecov.io/github/boostorg/nowide/commit/49ee87bc7abe98503dcccb79a1f9af7b56e6eb4e
Command executed with exception: 

Steps to Reproduce

Using this code:

  • ps: |
    If (env:COVERAGE -eq "true") { choco install opencppcoverage Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh OpenCppCoverage.exe --quiet --export_type cobertura:cobertura.xml ` --sources {env:APPVEYOR_BUILD_FOLDER} --modules “$PWD” `
    –cover_children --working_dir “$PWD” – ctest -C Debug
    bash codecov.sh -f cobertura.xml -n Appveyor -e APPVEYOR_BUILD_WORKER_IMAGE -X gcov -X search -Z
    }

Expected behavior: [What you expect to happen]

Return with zero exit code

Actual behavior: [What actually happens]

Unknown Exception

Flakiness? [Does this happen all the time or only sometimes?]

Started happing recently but seems to persist (restarted the failing job and it failed again) although only cpp code was changed.

This is strange @Flamefire, could you re-run with the -v argument? I’d like to see a more verbose output here, if possible.

Done. See the job at https://ci.appveyor.com/project/Flamefire/nowide-fr98b/builds/33865592/job/r4e06l05xtr5jrnd

Hi @Flamefire, I think it has to do with this

[00:00:57] curl: (3) URL using bad/illegal format or missing URL
[00:00:57] curl: (3) URL using bad/illegal format or missing URL
[00:00:57] curl: (3) URL using bad/illegal format or missing URL

I will be merging in a PR to fix this today, and we will deploy early next week. I’ll update you when this happens.

1 Like

Thanks for your reply. May I kindly ask if the deployment already happened or if there is a new estimate?
I’ll retrigger the PR to verify the result once the happened, but as that takes time too I’d do it rather sooner than later

Hi @Flamefire, we pushed late last night, would you be able to retrigger?

The “URL missing” issue seems to be fixed but it still fails: https://ci.appveyor.com/project/Flamefire/nowide-fr98b/builds/33979036/job/41may5l40x1jc513?fullLog=true

I’m puzzled that it shows an exit 0 at the end. Maybe it is the installed TERM trap?

Hello @tom ,

I have been following this thread as we were having the same ‘URL using bad/illegal format or missing URL’ issue.
https://ci.appveyor.com/project/cppmicroservices/cppmicroservices/builds/33798845/job/86hptlysekx6q2tx

After you pushed the changes, I do not see any bad URL issue.
However, it still fails.
https://ci.appveyor.com/project/apatil19/cppmicroservices-w9hy0/builds/33993079

@Flamefire Thank you for pointing this out.

@Flamefire @apatil19, thinking about how to make this more automated, but you should be able to add -U "-s" -A "-s" to the bash script which will fix the issue.

@Flamefire
bash codecov.sh -f cobertura.xml -n Appveyor -e APPVEYOR_BUILD_WORKER_IMAGE -X gcov -X search -Z -v -U "-s" -A "-s"

@apatil19
bash codecov.sh -f "./coverage_pathsfixed.xml" -U "-s" -A "-s"

@tom I can confirm that this is working. I’m a bit puzzled that this is only now required as my CI jobs worked fine till some time around last month ago

Anyway, thanks for your help!

@Flamefire, this is an issue with the way the bash script has been updated and with Powershell. We’re working on a fix to make the extra parameters unnecessary. Sorry for the breakage here, but glad it’s working now.

Hi @tom

Thank you for the prompt response.
With your suggested change, It surely works for me as well.!

I really appreciate the help you have provided.

1 Like

Hi @tom,

Even though our build passes successfully, I am still puzzled how these additional parameters fix the issue.
Is there any document you can point me to, or could you please help me understand?

Hi @apatil19, this deals with the way Powershell handles curl. Apparently, it doesn’t like the curl-like output, so the -s arguments silence them. This is what led me to suggesting the arguments.

Hi @tom,

Thank you.! That helps.!

1 Like