项目作者: msfidelis

项目描述 :
:package: :whale: :package: :whale: Local and Kubernetes example to deploy Sonarqube server to CI
高级语言:
项目地址: git://github.com/msfidelis/sonarqube-stack.git
创建时间: 2021-04-01T00:25:28Z
项目社区:https://github.com/msfidelis/sonarqube-stack

开源协议:

下载


Running Local

Setup local stack

  1. docker-compose up -d postgresql
  2. docker-compose up --force-recreate

Login

Access http://0.0.0.0:9000 in your browser and wait for sonar setup

The initial user and password for admin user is admin/admin. Change on first access.

Generate your user token for CI

Access in your user menu, My Account > Security > Generate Tokens

account

token

Configure sonar-project.properties on your application

  1. echo '''
  2. sonar.projectKey=chip
  3. sonar.projectName=chip
  4. sonar.sources=./
  5. sonar.sourceEncoding=UTF-8
  6. ''' > sonar-project.properties

Run your first scan

  1. docker run \
  2. --rm \
  3. -e SONAR_HOST_URL="http://0.0.0.0:9000" \
  4. -e SONAR_LOGIN=2f165ff1a9ed5241471d0a9ce32e8e93ac63ffa5 \
  5. -v "$(pwd):/usr/src" \
  6. --network host \
  7. sonarsource/sonar-scanner-cli

Kubernetes

Create namespace

  1. kubectl apply -f namespaces.yml

Edit and create configmaps and secrets

  1. kubectl apply -f configmap.yml

Deploy a postgresql stack

  1. kubectl apply -f postgresql.yml

Deploy a sonarqube stack

  1. kubectl apply -f sonarqube.yml

Run your first scan

  1. docker run \
  2. --rm \
  3. -e SONAR_HOST_URL="http://sonarqube.raj.ninja" \
  4. -e SONAR_LOGIN=2f165ff1a9ed5241471d0a9ce32e8e93ac63ffa5 \
  5. -v "$(pwd):/usr/src" \
  6. --network host \
  7. sonarsource/sonar-scanner-cli