From 377baf8203e1450ff40de65d7346a50e77462fe2 Mon Sep 17 00:00:00 2001 From: Rikza Kurnia Almujtaba <rikza.kurnia@ui.ac.id> Date: Sat, 24 Feb 2024 19:25:34 +0700 Subject: [PATCH] add sonarqube stage in CI/CD --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf0f66d5..6c612ef7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,30 @@ stages: + - sonarqube-check - deploy +sonarqube-check: + image: + name: sonarsource/sonar-scanner-cli:latest + entrypoint: [""] + variables: + 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 \ + -Dsonar.projectKey=eldira.lahanny_a4-logistik_AY3a82YUk9qxTTGJIC4V \ + -Dsonar.sources=. \ + -Dsonar.host.url=https://sonarqube.cs.ui.ac.id \ + -Dsonar.login=46ad35b1d3f133c21f7f85027d9475ae197d20d7 + -Dsonar.qualitygate.wait=true + + allow_failure: true + rules: + - if: $CI_COMMIT_REF_NAME == 'main' || $CI_PIPELINE_SOURCE == 'merge_request_event' + deploy-railway: stage: deploy image: ubuntu -- GitLab