From fae68f4fa78100261617044cd8c36e1fa3a7d5b3 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nicolas.pope@utu.fi> Date: Sat, 7 May 2022 08:45:37 +0100 Subject: [PATCH] Dont use code quality template --- .gitlab-ci.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 11f0118..86724d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,11 +15,64 @@ sast: include: - template: Security/SAST.gitlab-ci.yml -- template: Code-Quality.gitlab-ci.yml +#- template: Code-Quality.gitlab-ci.yml image: ubuntu:jammy +code_quality: + stage: test + image: docker:20.10.12 + allow_failure: true + services: + - name: 'docker:20.10.12-dind' + tags: + - docker + only: + - main + - merge_requests + variables: + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + CODE_QUALITY_IMAGE: "registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.26" + needs: [] + script: + - export SOURCE_CODE=$PWD + - | # this is required to avoid undesirable reset of Docker image ENV variables being set on build stage + function propagate_env_vars() { + CURRENT_ENV=$(printenv) + + for VAR_NAME; do + echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME " + done + } + - docker pull --quiet "$CODE_QUALITY_IMAGE" + - | + docker run --rm \ + $(propagate_env_vars \ + SOURCE_CODE \ + TIMEOUT_SECONDS \ + CODECLIMATE_DEBUG \ + CODECLIMATE_DEV \ + REPORT_STDOUT \ + REPORT_FORMAT \ + ENGINE_MEMORY_LIMIT_BYTES \ + CODECLIMATE_PREFIX \ + ) \ + --volume "$PWD":/code \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + "$CODE_QUALITY_IMAGE" /code + artifacts: + reports: + codequality: gl-code-quality-report.json + expire_in: 1 week + dependencies: [] + rules: + - if: '$CODE_QUALITY_DISABLED' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + + linux:build: only: - main -- GitLab