Skip to content

Codecov commit fails in Gitlab CI #586

Open
@TabulateJarl8

Description

When running codecov-cli in Gitlab CI, it seems to be submitting invalid data to the API. Below is a minimal example CI job:

test_python_parser:
  stage: test
  image: python:3.12
  before_script:
    - python -m pip install poetry codecov-cli
  script:
    - poetry install --with test
    - poetry run pytest . --cov=squiid_parser --cov-branch --cov-report=term-missing --cov-report=xml
    - codecovcli upload-process

This job outputs the following:

...
Coverage XML written to file coverage.xml
============================== 4 passed in 0.11s ===============================
$ codecovcli upload-process
info - 2025-01-12 05:13:43,163 -- ci service found: gitlab
warning - 2025-01-12 05:13:43,169 -- No config file could be found. Ignoring config.
info - 2025-01-12 05:13:43,173 -- Using token to create a commit for protected branch `{branch}`
info - 2025-01-12 05:13:43,413 -- Process Commit creating complete
error - 2025-01-12 05:13:43,413 -- Commit creating failed: [{"input":null,"loc":["username"],"msg":"Input should be a valid string","type":"string_type","url":"https://errors.pydantic.dev/2.4/v/string_type"}]
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

I also know that the coverage.xml file is being generated correctly, as doing the steps individually yields this result:

...
Coverage XML written to file coverage.xml
============================== 9 passed in 0.20s ===============================
$ codecovcli create-commit
info - 2025-01-12 05:24:57,589 -- ci service found: gitlab
warning - 2025-01-12 05:24:57,594 -- No config file could be found. Ignoring config.
info - 2025-01-12 05:24:57,598 -- Using token to create a commit for protected branch `{branch}`
info - 2025-01-12 05:24:57,894 -- Process Commit creating complete
error - 2025-01-12 05:24:57,894 -- Commit creating failed: [{"input":null,"loc":["username"],"msg":"Input should be a valid string","type":"string_type","url":"https://errors.pydantic.dev/2.4/v/string_type"}]
$ codecovcli create-report
info - 2025-01-12 05:24:58,213 -- ci service found: gitlab
warning - 2025-01-12 05:24:58,219 -- No config file could be found. Ignoring config.
info - 2025-01-12 05:24:58,408 -- Process Report creating complete
error - 2025-01-12 05:24:58,408 -- Report creating failed: [{"input":null,"loc":["username"],"msg":"Input should be a valid string","type":"string_type","url":"https://errors.pydantic.dev/2.4/v/string_type"}]
$ codecovcli do-upload
info - 2025-01-12 05:24:58,739 -- ci service found: gitlab
warning - 2025-01-12 05:24:58,744 -- No config file could be found. Ignoring config.
warning - 2025-01-12 05:24:58,749 -- xcrun is not installed or can't be found.
warning - 2025-01-12 05:24:58,757 -- No gcov data found.
warning - 2025-01-12 05:24:58,757 -- coverage.py is not installed or can't be found.
info - 2025-01-12 05:24:58,779 -- Found 1 coverage files to report
info - 2025-01-12 05:24:58,779 -- > /builds/ImaginaryInfinity/squiid-calculator/squiid-bindings/bindings/python/squiid_engine/coverage.xml
info - 2025-01-12 05:24:58,997 -- Process Upload complete
error - 2025-01-12 05:24:58,997 -- Upload failed: [{"input":null,"loc":["username"],"msg":"Input should be a valid string","type":"string_type","url":"https://errors.pydantic.dev/2.4/v/string_type"}]
Cleaning up project directory and file based variables 00:01
Job succeeded

However, these subcommands seem to always exit with status code 0, therefore not triggering a job failure. I have also set the correct CODECOV_TOKEN in my CI environment. I'd appriciate any help I can get with this issue, because it's preventing me from setting up codecov in my repository.

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions