user13821287
user13821287

Reputation:

Gitlab Code Quality not found file to write

I try to include Gitlab Code Quality in my pipeline. I host Gitlab on a windows 10 machine. After reading documentation about code quality I was tried all examples, with docker, without docker, with include but the pipeline still throws error WARNING: gl-code-quality-report.json: no matching files ERROR: No files to upload
ERROR: Job failed: exit status 1 Here is the job where I try with docker. I forget to say that Gitlab server does not in a container.

    code_quality:
  image: docker:stable
  variables:
    DOCKER_DRIVER: overlay2
    SP_VERSION: 0.85.6
  allow_failure: true
  services:
    - docker:stable-dind
  script:
    - docker run
        --env SOURCE_CODE="$PWD"
        --volume "$PWD":/code
        --volume /var/run/docker.sock:/var/run/docker.sock
        "registry.gitlab.com/gitlab-org/ci-cd/codequality:$SP_VERSION" /code
  artifacts:
    reports:
      codequality: gl-code-quality-report.json

Upvotes: 1

Views: 1515

Answers (2)

Andrea
Andrea

Reputation: 335

I've been able to include it in our linux hosted runners not using the docker-in-docker approach, but creating a specific runner with shell operator, and then creating a custom step that would launch the code-quality image with the docker-sock binding.

code_quality:
  stage: test
  rules:
  allow_failure: true
  script: 
    - |
      docker run \
        -v "/var/run/docker.sock:/var/run/docker.sock" \
        -v "$PWD:/code" \
        -e "SOURCE_CODE=$PWD" \
        -e "CODECLIMATE_CODE=$PWD" \
        registry.gitlab.com/gitlab-org/ci-cd/codequality:0.87.0 /code
  artifacts:
    reports:
      codequality:
      - gl-code-quality-report.json
    expire_in: 30 days
    paths:
    - gl-code-quality-report.json
  dependencies: []
  tags:
  - my-shell-runner

You could try to follow a similar approach for the windows machine.

Upvotes: 0

nilskch
nilskch

Reputation: 426

I had the same error in a self hosted version of gitlab, where I don't have a admin role in the project. I tested the same pipeline in gitlab.com and it worked well...

Upvotes: 1

Related Questions