400 error when using Bitride Codecov step

Please search for similar issues before creating a ticket.
All fields below are required.

Description

Using bitrise for our CI for an Android app written in Kotlin. Trying to use the bitrise codecov step to upload the, I get an 400 error saying there’s something wrong with the request. I have tried it from my local machine using bash <(curl -s https://codecov.io/bash) and it works, so not a problem with the set up I don’t think (although I could be wrong)

(I also raised it on github as an issue: https://github.com/codecov/codecov-bitrise/issues/10)

Commit SHAs

54065a3db2a9eac5049e4160d3eec4b0d3853759

Repository

https://app.codecov.io/bb/kumodi/circleloop-android

CI/CD or Build URL

Bitrise with the Codecov Step

Uploader

Whatever the Codecov bitrise step uses

Codecov Output

+------------------------------------------------------------------------------+

| (13) codecov@3                                                               |
+------------------------------------------------------------------------------+
| id: codecov                                                                  |
| version: 3.0.1                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2021-09-07T14:24:13Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/trustedkeys.gpg' created

100  3187  100  3187    0     0  20561      0 --:--:-- --:--:-- --:--:-- 20561
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 806BB28AED779869: public key "Codecov Uploader (Codecov Uploader Verification Key) <security@codecov.io>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpgv: can't allocate lock for '/root/.gnupg/trustedkeys.gpg'
gpgv: Signature made Tue 24 Aug 2021 08:58:39 PM UTC
gpgv:                using RSA key 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpgv: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <security@codecov.io>"
codecov: OK
[2021-09-07T14:24:15.093Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/
  Codecov report uploader 0.1.0
[2021-09-07T14:24:15.098Z] ['info'] => Project root located at: /bitrise/src
[2021-09-07T14:24:15.099Z] ['info'] ->  Token found by environment variables
[2021-09-07T14:24:15.189Z] ['info'] Searching for coverage files...
[2021-09-07T14:24:15.341Z] ['info'] => Found 2 possible coverage files:
  codecov.SHA256SUM
  codecov.SHA256SUM.sig
[2021-09-07T14:24:15.341Z] ['info'] Processing /bitrise/src/codecov.SHA256SUM...
[2021-09-07T14:24:15.343Z] ['info'] Processing /bitrise/src/codecov.SHA256SUM.sig...
[2021-09-07T14:24:15.353Z] ['info'] Detected Local as the CI provider.
[2021-09-07T14:24:15.360Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=bitrise-step-3.0.0-uploader-0.1.0&token=*******&branch=HEAD&build=&build_url=&commit= 18832323a83445c00f5e3bcf17b8abad9bab6157&job=&pr=&service=&slug=//git@bitbucket.org/*****/*****-android&name=&tag=&flags=&parent=
[2021-09-07T14:24:15.542Z] ['error'] Error POSTing to https://codecov.io: 400 Invalid request parameters
[2021-09-07T14:24:15.543Z] ['error'] Error: Error uploading to https://codecov.io: Error: Bad Request
WARN[14:24:15] Step (codecov@3) failed, but was marked as skippable 
|                                                                              |
+---+---------------------------------------------------------------+----------+
| ! | codecov@3 (exit code: 255)                                    | 2.75 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://community.codecov.io                                  |
| Source: https://github.com/codecov/codecov-bitrise                           |
+---+---------------------------------------------------------------+----------+

Expected Results

Coverage reports to be uploaded to Codecov

Actual Results

[2021-09-07T14:24:15.542Z] [‘error’] Error POSTing to https://codecov.io: 400 Invalid request parameters
[2021-09-07T14:24:15.543Z] [‘error’] Error: Error uploading to https://codecov.io: Error: Bad Request

Additional Information

Section of our bitrise.yml

      - codecov@3.0:
          inputs:
            - OS: linux
            - CODECOV_TOKEN: $CODECOV_TOKEN

Got it, thanks @kaylanx. Do you mind sharing the output of the bash uploader? Note that we are deprecating it, but I would like to get the Step to be working for you.

Sure this is it…

$ bash <(curl -s https://codecov.io/bash)

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


==> git version 2.30.1 (Apple Git-130) found
==> curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
x> No CI provider detected.
    Testing inside Docker? http://docs.codecov.io/docs/testing-with-docker
    Testing with Tox? https://docs.codecov.io/docs/python#section-testing-with-tox
    current dir:  /Users/kayleya/Development/client/circleloop-android
    project root: .
--> token set from env
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
==> Processing Xcode reports via llvm-cov
    DerivedData folder: /Users/kayleya/Library/Developer/Xcode/DerivedData
    -> No Swift coverage found
    -> Running gcov for Obj-C
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
    -> Found 2 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./codecov.SHA256SUM bytes=73
    + ./codecov.SHA256SUM.sig bytes=833
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    + Found adjustments
==> Gzipping contents
        4.0K	/tmp/codecov.g2Xhjy.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=feature%2Fbitrise&commit=e4b864388c8cacf28df3c3c3fab845fafa0fa633&build=&build_url=&name=&tag=&slug=kumodi%2Fcircleloop-android&service=&flags=&pr=&job=&cmd_args=
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.6&token=<hidden>&package=bash-1.0.6&token=**********&branch=feature%2Fbitrise&commit=e4b864388c8cacf28df3c3c3fab845fafa0fa633&build=&build_url=&name=&tag=&slug=kumodi%2Fcircleloop-android&service=&flags=&pr=&job=&cmd_args=
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-09-08/E93F0D5AC22CDB93DDE932FFD89D1B19/e4b864388c8cacf28df3c3c3fab845fafa0fa633/863c84a2-59fb-40e9-ae3b-acfdad988f7d.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EKKHVKCKHW7KBCGM7IHR55T63V2PAVJWLVFNITJHDU5G6R5IRN3LMWJA%2F20210908%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20210908T141033Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=0ac6433164ce9392af041ebd59b9e6f52efca62d797e0adb3c4fa9a717566c44
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3252    0     0  100  3252      0   7242 --:--:-- --:--:-- --:--:--  7226
    -> Reports have been successfully queued for processing at https://codecov.io/bitbucket/kumodi/circleloop-android/commit/e4b864388c8cacf28df3c3c3fab845fafa0fa633

Got it. One thing to note @kaylanx is that the files that are being uploaded are just SHA256 files (both in the bash and step). I’ll take a look into fixing the step.

I noticed that :confused: trying to figure that out too, and thank you for your help. I did try the version 2 of the step and that did send some data across but still failed. I can see some stuff there from when I tried that.

Could I ask where it looks for the files?

On bitrise I can see i have a jacoco coverage xml file here… $PROJECT_HOME/app/build/reports/jacoco/testCircleloopStagingUnitTestCoverage/testCircleloopStagingUnitTestCoverage.xml

Why isn’t codecov finding it?

Yes, it looks in the project root which in the first case was this. This is really stupid, but what if you renamed the file coverage.xml? I have a sneaky suspicion about one of our regexes.