Bluety
Bluety

Reputation: 1909

Gitlab CI - How to use coverage_report with multiple path?

Since gitlab 14.9 report syntax has changed, I don't know how to convert part of my report related code (cobertura). https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportscoverage_report

How do I convert my file from the old syntax which accepted an array for the cobertura key to the new syntax (coverage_report) and the path key which only accepts a string?

I have this:

artifacts:
  reports:
    cobertura: [ fold1/build/cobertura.xml, fold2/build/cobertura.xml ]

Upvotes: 2

Views: 3425

Answers (2)

user2025261
user2025261

Reputation: 377

Thanks @sytech for the correct answer.

Gitlab 14.10 changed the config format for coverage reports: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportscoverage_report

This worked for me:

  artifacts:
    when: always
    reports:
      junit: junit.xml
      coverage_report:
        coverage_format: cobertura
        path: packages/*/coverage/cobertura-coverage.xml

Upvotes: 2

sytech
sytech

Reputation: 41119

Arrays don't seem to be supported according to the documentation, but you can use a glob pattern.

artifacts:
  reports:
    cobertura: "**/build/cobertura.xml"

Upvotes: 5

Related Questions