Skip to content

Code Quality Job Template isn't working

I'm currently testing GitLab EE with a trial license and our primary focus was to check the code quality feature. Sadly the job template isn't really working. It runs, but creates no artifact (gl-code-quality-report.json).

Here is my .gitlab-ci.yml (copied directly from the template file):

stages:
  - test

# variables:
#   CODECLIMATE_DEBUG: 1
#   REPORT_STDOUT: 1

code_quality:
  stage: test
  image: docker:stable
  allow_failure: true
  services:
    - docker:stable-dind
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
  script:
    - docker run
        --env SOURCE_CODE="$PWD"
        --volume "$PWD":/code
        --volume /var/run/docker.sock:/var/run/docker.sock
        "registry.gitlab.com/gitlab-org/security-products/codequality:12-3-stable" /code
  artifacts:
    reports:
      codequality: gl-code-quality-report.json
    expire_in: 1 week
  dependencies: []
  only:
    refs:
      - branches
      - tags
  except:
    variables:
      - $CODE_QUALITY_DISABLED

The output is the following:

Running with gitlab-runner 12.2.0 (a987417a)
  on 1872f10e1db7 Csi_pYkT
Using Docker executor with image docker:stable ...
Starting service docker:stable-dind ...
Pulling docker image docker:stable-dind ...
Using docker image sha256:5768e15eefd175c1ba6969b616cfe827152556c5fe691b9258cb57d1a5c37e9d for docker:stable-dind ...
Waiting for services to be up and running...

*** WARNING: Service runner-Csi_pYkT-project-1-concurrent-0-docker-0 probably didn't start properly.

Health check error:
service "runner-Csi_pYkT-project-1-concurrent-0-docker-0-wait-for-service" timeout

Health check container logs:


Service container logs:
2019-09-16T06:28:53.095879600Z time="2019-09-16T06:28:53.095505900Z" level=info msg="Starting up"
2019-09-16T06:28:53.098924300Z time="2019-09-16T06:28:53.098399800Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
2019-09-16T06:28:53.098953700Z failed to load listeners: can't create unix socket /var/run/docker.sock: device or resource busy

*********

Pulling docker image docker:stable ...
Using docker image sha256:b40e5afd78f53c1f0591358707e06ee7ca2778291dc53864fc1195fc7f3a011a for docker:stable ...
Running on runner-Csi_pYkT-project-1-concurrent-0 via 08dec4308843...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/fr-test/platform/.git/
From https://gitlab.xxx.xx/fr-test/platform
   ba44304f..f7db9d8b  master     -> origin/master
Checking out f7db9d8b as master...

Skipping Git submodules setup
$ docker run --env SOURCE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/codequality:12-3-stable" /code
WARNING: A new version (v0.85.5) is available. Upgrade instructions are available at: https://github.com/codeclimate/codeclimate#packages
Uploading artifacts...
WARNING: gl-code-quality-report.json: no matching files 
ERROR: No files to upload                        
Job succeeded

My Runner runs on Docker for Mac with the following config.toml:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "1872f10e1db7"
  url = "https://gitlab.xxx.xx/"
  token = "xxx"
  executor = "docker"
  output_limit = 15360
  [runners.custom_build_dir]
  [runners.docker]
    tls_verify = false
    image = "busybox"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    shm_size = 0
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

Sadly the issues for the repository of the docker image are disabled. That's the reason I submit it here in hope to get some help.

Another customer that's run into this with private runners but on gitlab.com sees this occasional error: Failed to load listeners “can’t create unix socket /var/run/docker.soc: device or resource busy”


PS: I've also tested to run codeclimate directly. In this case the output json file will be created, but codeclimate doesn't use the .codeclimate.yml file in my repository. 🤨

Edited by James Heimbuck