0

The GitLab pipeline (for a dotnet project) is not validated because of the error "jobs:build:artifacts:reports config contains unknown keys: cobertura". So the pipeline of course can't be triggered.

Error message is here

I even tried to remove the code coverage thing, but also didn't know to achieve correctly (many attemps with other errors).

When I looked in the forums, I did find and follow many links like:

But both didn't work out.

This is the pipeline code is:

variables:
  OBJECTS_DIRECTORY: "obj"
  NUGET_PACKAGES_DIRECTORY: ".nuget"
  SOURCE_CODE_PATH: "$CI_PROJECT_DIR"
  SELF_CONTAINED: "false"
  BUILD_TARGET: "Release"
  DOTNET_IMAGE: mcr.microsoft.com/dotnet/core/sdk:3.1
  SKIP_TESTS: "false"

# Coverage: TBD https://gitlab.com/gitlab-org/gitlab/-/issues/217664
.dotnet.build:
  image: $DOTNET_IMAGE
  script:
    - dotnet nuget add source "$NUGET_REPO" --name gitlab --username ???? --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'


.dotnet.pack:
  image: $DOTNET_IMAGE
  artifacts:
    paths:
      - '**/bin/$BUILD_TARGET/*.nupkg'
  script:
    - PACKAGE_VERSION="$VERSION"
    - if [ -n "$CI_MERGE_REQUEST_ID" ]; then PACKAGE_VERSION="${VERSION}-dev"; fi;
    - dotnet pack -p:PackageVersion="$PACKAGE_VERSION" "$SOURCE_CODE_PATH" -c "$BUILD_TARGET" --no-build --packages "$NUGET_PACKAGES_DIRECTORY"

.dotnet.push:
  image: $DOTNET_IMAGE
  script:
    - dotnet nuget add source "$NUGET_REPO" --name gitlab --username ???? --password ???? --store-password-in-clear-text
    - dotnet nuget push "**/bin/$BUILD_TARGET/*.nupkg" --source gitlab

Bilel-NEJI
  • 61
  • 9
  • The message is pretty clear about the problem. There is no such keyword as "cobertura" defined in gitlab specification. Gitlab specification can be found here: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html – Artur Oct 14 '22 at 07:58
  • When you used suggested resolution from the first link, what error occured? Resolution from first link is in documentation so it should work. – Artur Oct 14 '22 at 08:00
  • also, your first link shows exactly the answer to your problem. https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportscoverage_report here yo see the format for cobertura reports – Jeanot Zubler Oct 14 '22 at 08:00
  • also see this answer, on why the "cobertura" keyword does not work https://stackoverflow.com/a/72138271/14906662 – Jeanot Zubler Oct 14 '22 at 08:02
  • @Artur, the error message was: ```Project `sts_cloud_platform/sts_templates/cicd` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined.``` @JeanotZubler, but I think that GitLab spec. says that it is available from GitLab version 15 and I'm using 15.5 – Bilel-NEJI Oct 14 '22 at 08:17
  • 1
    @Bilel-NEJI at least for me this error suggests that everything worked but project `sts_cloud_platform/sts_templates/cicd`, whatever this project is, is not reachable and that is the problem you need to resolve. If you have version 15.5 and some feature is available from version 15 it applies to your version. – Artur Oct 14 '22 at 08:23
  • If it is possible to remove the code coverage thing and end the error, it'll be great, since my current goal is to run the pipeline successfully. If you can tell me what to remove exactly? – Bilel-NEJI Oct 14 '22 at 08:25
  • @Artur, can you tell how to deal with this project "sts_cloud_platform.....". I have no clue where to find (looks weird, but it is not a project that I wrote) – Bilel-NEJI Oct 14 '22 at 08:29
  • @Bilel-NEJI I am sorry but I can't help you with that. I don't know the project/system you are working in. You should check your repository and find what this project is – Artur Oct 14 '22 at 09:27
  • Does this answer your question? [Gitlab pipeline - reports config contains unknown keys: cobertura](https://stackoverflow.com/questions/72138080/gitlab-pipeline-reports-config-contains-unknown-keys-cobertura) – Artur Oct 14 '22 at 09:27
  • @Artur, as I told you; after following that link now I do get the ``` Project `sts_cloud_platform/sts_templates/cicd` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined. ``` – Bilel-NEJI Oct 14 '22 at 09:35
  • @Bilel-NEJI that was an auto-generated response as I marked this question as a duplicate – Artur Oct 14 '22 at 09:36

0 Answers0