Container to be used with sonar-gitlab-plugin
10K+
This is a fork with
Typescriptsupport
Container to be used with Typescript based repositories and SonarQube >= 8.1.
sonar-scanner
ships an embedded JRE so image is now based on node:lts-slim.
Add the next stage to your .gitlab-ci.yml.
stages:
- analysis
sonarqube:
stage: analysis
image:
name: widerin/gitlab-sonar-scanner:latest
entrypoint: [""]
variables:
SONAR_URL: http://your.sonarqube.server
before_script:
- sonar-scanner --version
script:
- sonar-scanner
-Dsonar.login="${SONAR_LOGIN}"
-Dsonar.host.url="${SONAR_URL}"
-Dsonar.branch.name=${CI_COMMIT_REF_NAME}
-Dsonar.projectName="${CI_PROJECT_PATH}"
-Dsonar.projectKey="gitlab-${CI_PROJECT_ID}"
-Dsonar.projectVersion="$(git describe --tags $(git rev-list --tags --max-count=1))"
Remember to also create a sonar-project.properties file:
sonar.projectKey=your-project-key
sonar.exclusions=node_modules/**,coverage/**
sonar.sources=.
Before running the analysis stage you should ensure to have the project created in your sonarqube + having it configured to use the gitlab plugin (specifying the gitlab repo url).
You also need to give developer permissions to the user that will comment in gitlab.
Can be checked in the official documentation: https://docs.sonarqube.org/latest/analysis/analysis-parameters/
SONAR_URLSONAR_TOKENSONAR_DEBUGDeprecated and ignored environment variables:
SONAR_PROJECT_KEYSONAR_PROJECT_VERSIONSONAR_GITLAB_PROJECT_IDSONAR_SOURCESSONAR_PROFILESONAR_LANGUAGESONAR_ENCODINGSONAR_BRANCHSONAR_ANALYSIS_MODEAll the code contained in this repository is licensed under a GNU-GPLv3 license.
Copyright Alvarium.io 2017-2018.
See LICENSE for more details
Content type
Image
Digest
Size
170.4 MB
Last updated
over 6 years ago
docker pull widerin/gitlab-sonar-scanner