Sign inSign up

widerin/gitlab-sonar-scanner

By widerin

•Updated over 6 years ago

Container to be used with sonar-gitlab-plugin

Image
0

10K+

widerin/gitlab-sonar-scanner repository overview

⁠gitlab-sonar-scanner

This is a fork with Typescript support

pulls

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.

⁠Using it in your gitlab projects

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.

⁠Environment variables

Can be checked in the official documentation: https://docs.sonarqube.org/latest/analysis/analysis-parameters/⁠

  • SONAR_URL
  • SONAR_TOKEN
  • SONAR_DEBUG

Deprecated and ignored environment variables:

  • SONAR_PROJECT_KEY
  • SONAR_PROJECT_VERSION
  • SONAR_GITLAB_PROJECT_ID
  • SONAR_SOURCES
  • SONAR_PROFILE
  • SONAR_LANGUAGE
  • SONAR_ENCODING
  • SONAR_BRANCH
  • SONAR_ANALYSIS_MODE
⁠Deprecated docker tags

⁠LICENSE

All the code contained in this repository is licensed under a GNU-GPLv3 license.

Copyright Alvarium.io 2017-2018.

See LICENSE⁠ for more details

Tag summary

Content type

Image

Digest

Size

170.4 MB

Last updated

over 6 years ago

docker pull widerin/gitlab-sonar-scanner