All Projects → ciricihq → gitlab-sonar-scanner

ciricihq / gitlab-sonar-scanner

Licence: GPL-3.0 license
This project is no longer maintained

Programming Languages

shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to gitlab-sonar-scanner

gitlabby-dockerish-laravel
What happens when you Dockerize your Laravel testing environment and throw it at Gitlab CI?
Stars: ✭ 33 (-58.75%)
Mutual labels:  gitlab, gitlab-runner
gitlab-runner
Gitlab Runner on Alpine Linux [Docker]
Stars: ✭ 17 (-78.75%)
Mutual labels:  gitlab, gitlab-runner
gitlab-chart
Kubernetes Helm chart to deploy GitLab
Stars: ✭ 59 (-26.25%)
Mutual labels:  gitlab, gitlab-runner
podman-gitlab-runner
Use Podman as a custom executor for your Gitlab CI
Stars: ✭ 87 (+8.75%)
Mutual labels:  gitlab, gitlab-runner
gitlab-ci-runner-marathon
A customized Docker image for running scalable GitLab CI runners on Marathon
Stars: ✭ 14 (-82.5%)
Mutual labels:  gitlab, gitlab-runner
gitlab-ci-android-fastlane
Docker image for building android apps on Gitlab CI
Stars: ✭ 25 (-68.75%)
Mutual labels:  gitlab, gitlab-runner
gitlab-runner
GitLab Runner (Docker image) for ARM devices, this is a mirror repository of
Stars: ✭ 17 (-78.75%)
Mutual labels:  gitlab, gitlab-runner
Env Ci
Get environment variables exposed by CI services
Stars: ✭ 180 (+125%)
Mutual labels:  gitlab
Pronto
Quick automated code review of your changes
Stars: ✭ 2,450 (+2962.5%)
Mutual labels:  gitlab
Webhookit
Simple git webhook cli tool for automation tasks, bind git webhook to action.
Stars: ✭ 177 (+121.25%)
Mutual labels:  gitlab
Alfred Gitlab
A GitLab workflow for Alfred 3
Stars: ✭ 176 (+120%)
Mutual labels:  gitlab
Tox
Command line driven CI frontend and development task automation tool.
Stars: ✭ 2,523 (+3053.75%)
Mutual labels:  gitlab
Gitlab Cli
Create a merge request from command line in gitlab
Stars: ✭ 224 (+180%)
Mutual labels:  gitlab
Gitlabber
Gitlabber - clones or pulls entire groups tree from gitlab
Stars: ✭ 176 (+120%)
Mutual labels:  gitlab
Git Link
Emacs package to get the GitHub/Bitbucket/GitLab/... URL for a buffer location
Stars: ✭ 239 (+198.75%)
Mutual labels:  gitlab
Saltshaker api
saltshaker_plus restful api
Stars: ✭ 177 (+121.25%)
Mutual labels:  gitlab
Git Auto Deploy
Deploy your GitHub, GitLab or Bitbucket projects automatically on Git push events or web hooks
Stars: ✭ 251 (+213.75%)
Mutual labels:  gitlab
Kubernetes Container Service Gitlab Sample
This code shows how a common multi-component GitLab can be deployed on Kubernetes cluster. Each component (NGINX, Ruby on Rails, Redis, PostgreSQL, and more) runs in a separate container or group of containers.
Stars: ✭ 240 (+200%)
Mutual labels:  gitlab
Terraform Provider Gitlab
Terraform GitLab provider
Stars: ✭ 205 (+156.25%)
Mutual labels:  gitlab
Iky
OSINT Project
Stars: ✭ 203 (+153.75%)
Mutual labels:  gitlab

gitlab-sonar-scanner

pulls

Container to be used with sonar gitlab plugin.

Using it in your gitlab projects

Add the next stage to your .gitlab-ci.yml.

stages:
- analysis

sonarqube:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: http://your.sonarqube.server
    SONAR_ANALYSIS_MODE: issues
  script:
  - gitlab-sonar-scanner

Remember to also create a sonar-project.properties file:

sonar.projectKey=your-project-key
sonar.exclusions=node_modules/**,coverage/**

sonar.sources=.

[email protected]

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.

Sending the data to sonar

The previous stage will play along the gitlab plugin to publish all the coments in it, but if you wanna send the analysis reports to sonar, you should change two things:

stages:
- analysis

sonarqube-reports:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: http://your.sonarqube.server
    SONAR_ANALYSIS_MODE: publish
  script:
  - gitlab-sonar-scanner

Note how we've changed from issues to publish in SONAR_ANALYSIS_MODE.

Full .gitlab-ci.yaml with preview + publish

stages:
- analysis

sonarqube:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: http://your.sonarqube.server
    SONAR_ANALYSIS_MODE: issues
  script:
  - gitlab-sonar-scanner

sonarqube-reports:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: http://your.sonarqube.server
    SONAR_ANALYSIS_MODE: publish
  script:
  - gitlab-sonar-scanner

Available environment variables

Can be checked in the official documentation: https://docs.sonarqube.org/display/SONARQUBE43/Analysis+Parameters

  • SONAR_URL
  • SONAR_PROJECT_VERSION
  • SONAR_DEBUG
  • SONAR_SOURCES
  • SONAR_PROFILE
  • SONAR_LANGUAGE
  • SONAR_PROJECT_NAME
  • SONAR_BRANCH
  • SONAR_ANALYSIS_MODE

sonar-gitlab specific

  • SONAR_GITLAB_PROJECT_ID: The unique id, path with namespace, name with namespace, web url, ssh url or http url of the current project that GitLab.
  • CI_BUILD_REF: See ci/variables
  • CI_BUILD_REF_NAME: See ci/variables

Defining custom sonar-scanner options

You can pass any additional option to the gitlab-sonar-scanner binnary, if needed:

sonarqube-reports:
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: http://your.sonarqube.server
    SONAR_ANALYSIS_MODE: publish
  script:
  - gitlab-sonar-scanner -Dsonar.custom.param=whatever -Dsonar.custom.param2=whichever

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].