Code Quality Job Failed

Replace this template with your information

Hi, I have problem with code quality job. It’s always failed without further details.

This is my first time enabling the job on my particular repository. And fyi, for the other repository, the code quality job is working normally. However, on this one repository, it have error like this:

registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.26
$ docker run --rm \ # collapsed multi-line command
sh: null: out of range
WARNING: A new version (v0.85.29) is available. Upgrade instructions are available at: https://github.com/codeclimate/codeclimate#packages
WARNING: A new version (v0.85.29) is available. Upgrade instructions are available at: https://github.com/codeclimate/codeclimate#packages
error: (CC::CLI::Analyze::EngineFailure) engine csslint ran for 900 seconds and was killed
Could not analyze code quality for the repository at /code

Then I followed the solution from Code Quality CI Job fails - A new version (v0.71.0) is available (#20761) · Issues · GitLab.org / GitLab · GitLab to add CONTAINER_TIMEOUT_SECONDS=3600 to the variables.

After that, I still got error like this:

$ docker pull --quiet "$CODE_QUALITY_IMAGE"
registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.26
$ docker run --rm \ # collapsed multi-line command
sh: null: out of range
WARNING: A new version (v0.85.29) is available. Upgrade instructions are available at: https://github.com/codeclimate/codeclimate#packages
WARNING: A new version (v0.85.29) is available. Upgrade instructions are available at: https://github.com/codeclimate/codeclimate#packages
ERROR: Job failed: execution took longer than 1h0m0s seconds
  • What are you seeing, and how does that differ from what you expect to see?

I expect the job run smoothly.

  • Consider including screenshots, error messages, and/or other helpful visuals

  • What version are you on? Are you using self-managed or GitLab.com?

  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)


image: php:latest

stages:
  - build
  - test
  - deploy
  - review
  - dast
  - staging
  - canary
  - production
  - incremental rollout 10%
  - incremental rollout 25%
  - incremental rollout 50%
  - incremental rollout 100%
  - performance
  - cleanup
  - release

variables:
  POSTGRES_USER: user
  POSTGRES_PASSWORD: pass
  POSTGRES_DB: db
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: ""

services:
  - name: postgres:14-alpine
    alias: database
  - name: redis:latest
    alias: redis

cache:
  paths:
    - vendor/
    - node_modules/

test:
  image: php:latest
  variables:
    POSTGRES_USER: user
    POSTGRES_PASSWORD: pass
    POSTGRES_DB: name
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
  services:
    - name: postgres:14-alpine
      alias: database
    - name: redis:latest
      alias: redis
  cache:
    paths:
      - vendor/
      - node_modules/
  before_script:
    - apt update -yqq
    - apt install gnupg -yqq
    - curl -sL https://deb.nodesource.com/setup_14.x | bash -
    - apt install git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev libonig-dev libzip-dev -yqq
    - docker-php-ext-install mbstring pdo_pgsql pdo_mysql curl intl gd xml zip bz2 opcache
    - pecl install xdebug
    - docker-php-ext-enable xdebug
    - curl -sS https://getcomposer.org/installer | php
    - php composer.phar install
    - npm install
    - cp .env.testing .env
    - npm run dev
    - php artisan key:generate
    - php artisan config:cache
    - php artisan migrate
    - php artisan db:seed
  script:
    - php vendor/bin/phpunit --coverage-text --colors=never
    - npm test

sast:
  stage: test

include:
  - template: Jobs/Build.gitlab-ci.yml
  - template: Jobs/Test.gitlab-ci.yml
  - template: Jobs/Code-Quality.gitlab-ci.yml
  - template: Jobs/Code-Intelligence.gitlab-ci.yml
  - template: Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml
  - template: Verify/Browser-Performance.gitlab-ci.yml
  - template: Security/DAST.gitlab-ci.yml
  - template: Security/Container-Scanning.gitlab-ci.yml
  - template: Security/Dependency-Scanning.gitlab-ci.yml
  - template: Security/License-Scanning.gitlab-ci.yml
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Secret-Detection.gitlab-ci.yml
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I already followed Code Quality CI Job fails - A new version (v0.71.0) is available (#20761) · Issues · GitLab.org / GitLab · GitLab

Thanks for taking the time to be thorough in your request, it really helps! :blush:

1 Like

Code quality scans use CodeClimate. The timeout may be reproducible with a local Docker command test too.

Following Troubleshooting Plugin Timeouts it might be the case that there are too many files in the repository to scan.

You can configure CodeClimate and exclude more directories to see if that helps.

@asdasdasd If eslint is not used (configured) in your repo, you will see such an error message. If so, check it out the issue I just filed in a few days: Warning message is not understandable when eslint is not included in package.json (#55) · Issues · GitLab.org / Ops Sub-Department / codequality · GitLab

Per the following error, why not trying out 7200 sec?

variables:
  TIMEOUT_SECONDS: 7200

It seems your project is based on PHP, so GitLab’s Code Quality can evaluate only CSS and JS files with some code duplications, so I don’t expect to take such a longer time… :thinking: