From f9572d05591c9b14764e5556e9572656244cfa8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Tue, 27 Feb 2024 16:50:54 +0100 Subject: [PATCH] Add sonar integration --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ sonar-project.properties | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 sonar-project.properties diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a07582e..80975ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,9 +5,32 @@ variables: stages: + - code_quality - deploy +code_quality:sonarqube: + stage: code_quality + tags: + - code_quality + image: + name: leadrien/isc-sonar-scanner-cli + entrypoint: [ "" ] + variables: + GIT_SUBMODULE_STRATEGY: recursive + GIT_SUBMODULE_FORCE_HTTPS: "true" + SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache + GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task + cache: + key: "${CI_JOB_NAME}" + paths: + - .sonar/cache + script: + - sonar-scanner + rules: + - if: '$CI_COMMIT_TAG =~ "/^$/"' + + deploy: image: docker:latest stage: deploy diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..84c36f4 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,3 @@ +sonar.projectKey=DojoBackend +sonar.qualitygate.wait=true +sonar.exclusions=API/**, Frontend/** \ No newline at end of file -- GitLab