diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf0f66d5b15113c1e86c9c9a1b55454b22096a07..6c612ef7c09f29ad8abeb4ba114f5d91a82140f1 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