GitlLab Pipeline issue: yaml invalid because of "reports config contains unknown keys: cobertura"

Hello,
I’m trying to run a GitLab pipeline that can not be even triggered since I get a message “jobs:build:artifacts:reports config contains unknown keys: cobertura”.

This the pipeline-part of code:

.dotnet.build:
  image: $DOTNET_IMAGE
  script:
    - dotnet nuget add source "$NUGET_REPO" --name gitlab --username $NUGET_USER --password $NUGET_PASSWORD --store-password-in-clear-text
    - dotnet restore "$SOURCE_CODE_PATH" --packages "$NUGET_PACKAGES_DIRECTORY"
    - dotnet build "$SOURCE_CODE_PATH" -c "$BUILD_TARGET" --no-restore
    - if [ "$SKIP_TESTS" = "false" ]; then dotnet test "$SOURCE_CODE_PATH" -c "$BUILD_TARGET" -p:CollectCoverage=true -p:CoverletOutputFormat=\"opencover\" --no-build --test-adapter-path:. --logger:"junit;LogFilePath=.\artifacts\test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose"; fi
    - dotnet publish "$SOURCE_CODE_PATH" -c "$BUILD_TARGET" --no-build --self-contained "$SELF_CONTAINED"
  cache:
    key: "${CI_JOB_STAGE}-${CI_COMMIT_REF_SLUG}-dotnet"
    paths:
      - "$SOURCE_CODE_PATH/$OBJECTS_DIRECTORY/project.assets.json"
      - "$SOURCE_CODE_PATH/$OBJECTS_DIRECTORY/*.csproj.nuget.*"
      - "$NUGET_PACKAGES_DIRECTORY"
    policy: pull-push
  coverage: /Total\s*\|\s*(\d+(?:\.\d+)?)/
  artifacts:
    paths:
      - '**/*test-result.xml'
      - '**/bin/'
      - '**/*coverage.opencover.xml'
      - "$SOURCE_CODE_PATH/$OBJECTS_DIRECTORY/project.assets.json"
      - "$NUGET_PACKAGES_DIRECTORY"
    reports:
      junit:
        - '**/*test-result.xml'
      cobertura:
        - '**/*coverage.opencover.xml'

I already did try to follow the solution of reported issue (Cobertura Reports invalidate CI YAML - #4 by felix-rhebo), but it didn’t work.

The GitLab version that I’m using is: 15.5

Hey, did you find an answer to this?

See the workaround after removal of the keyword in 15.x - Removal of artifacts:report:cobertura keyword (#348980) · Issues · GitLab.org / GitLab · GitLab

1 Like

Thank you.

Can I also ask if passing the image as a variable worked fine for you? I keep getting an issue saying image is already defined at the top level

I’m not sure how image relates to cobertura reports. Mind opening a new topic and add more details on versions, configuration, and screenshots? The topic templates will guide you on required details.