Work inspired by ciricihq/gitlab-sonar-scanner
Add the next stage to your .gitlab-ci.yml.
stages:
- quality-gate
sonarqube:
  stage: quality-gate
  image: dcuenot/gitlab-sonar-scanner:1.0.0
  variables:
      SONAR_URL: https://your.sonarqube.server
      SONAR_LOGIN: "${SONAR_TOKEN}"
      SONAR_PROJECT_KEY: "${CI_PROJECT_NAME}"
      SONAR_PROJECT_NAME: "${CI_PROJECT_TITLE}"
  script:
    - gitlab-sonar-scanner
    - sonar_qgIf you need to add a specific configuration, you can also create a sonar-project.properties file.
Prerequisite:
- Generate a Gitlab personal access token with the scope api
- Add the next stage to your .gitlab-ci.yml
- Open a merge request
stages:
- quality-gate
sonarqube:
  stage: quality-gate
  image: dcuenot/gitlab-sonar-scanner:1.0.0
  variables:
      SONAR_URL: https://your.sonarqube.server
      SONAR_LOGIN: "${SONAR_TOKEN}"
      SONAR_PROJECT_KEY: "${CI_PROJECT_NAME}"
      SONAR_PROJECT_NAME: "${CI_PROJECT_TITLE}"
  script:
    - gitlab-sonar-scanner
    - sonar_qg --gitlab_personal_token "${GITLAB_PERSONAL_TOKEN}"Sonar Quality Gate CLI 1.0.0
USAGE:
    sonar_qg [FLAGS] [OPTIONS] [report-task-path]
FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
    -v, --verbose    Verbose mode (-v, -vv, -vvv, etc.)
OPTIONS:
    -g, --gitlab_personal_token <gitlab-personal-token>     [env: GITLAB_PERSONAL_TOKEN=]
ARGS:
    <report-task-path>     [default: .scannerwork/report-task.txt]
All the code contained in this repository is licensed under a MIT License.
See LICENSE for more details
All contribution are more than welcomed! If you need more information about contribution, details are in CONTRIBUTING.md

