Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:git:sonarqube [2022/05/03 06:33] jsdev:git:sonarqube [2022/05/09 11:31] (current) mb
Line 5: Line 5:
 Homepage: [[https://www.sonarqube.org/]] Homepage: [[https://www.sonarqube.org/]]
  
-==== Install Server ==== 
  
- +  * [[dev:git:sonar:addproject|Add gitlab project to Sonarqube]] 
-==== Activate in Projekt on GitLab ==== +  * [[dev:git:sonar:modifyrules|Modify rules in quality profile]] 
-Doc: [[https://docs.sonarqube.org/latest/analysis/gitlab-integration/]] +  [[dev:git:sonar:pipetrigger|Create and use pipeline trigger]]
- +
-  - Create Access Token in Gitlab in the Instance, Group or Project +
-      - Token nameSonarQube +
-      - Scopesapi +
-      - Expiration date: empty = no +
-      - Role: Reporter +
-    Save the group access token +
- +
-==== Import GitLab Project into SonarQube ==== +
-  - Add Projekt +
-  - Enter group access token +
-  - Select Project you want to add +
-  - Choose "With GitLab CI" for analyze your repository +
-  - Project key: Other +
- +
-==== Configure Project in Gitlab ==== +
- +
-  - add file: **.sonar-project.properties** +
-      * In root dir of the project.  +
-      * Filename.sonar-project.properties +
-      * Content<code>sonar.projectKey=<project-name>_<key from sonarqube> +
-sonar.qualitygate.wait=false +
-sonar.python.version=2 +
-</code> +
-  - Add two vars to ProjectSettings-> CI/CD -> Variables +
-      - key: SONAR_TOKEN +
-        - Value: generate token in SonarQube Webinterface +
-        - uncheck "Protect Variable" +
-        - CHECK "Mask Variable" +
-      - key: SONAR_HOST_URL +
-        - Value: https://sq.schnuerle.com:9999 +
-        - Uncheck both: Protect Variable / Mask Variable +
- +
-  - add .sonar-wrapper script to project in root dir +
-  - add sonarqube job in .gitlab-ci.yml<code>stages: +
- - sonarqube +
-  +
-  +
-sonarqube_check_job: +
-  only: +
-    refs: +
-      - tags +
-    variables: +
-      - $CI_COMMIT_TAG =~ /^[Cc]heck_source-.*$/                                                         # commit tag starts job +
-  image:  +
-    name: sonarsource/sonar-scanner-cli:latest +
-    entrypoint: [""+
-  tags: +
-    - sonarqube-runner +
-  stage: sonarqube +
-  variables: +
-    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"                                                          # Defines the location of the analysis task cache +
-    GIT_DEPTH: "0"                                                                                       # Tells git to fetch all the branches of the project, required by the analysis task +
-  cache: +
-    key: "${CI_JOB_NAME}" +
-    paths: +
-      - .sonar/cache +
-    script +
-      # we use a wrapper script to detect files without extension - all parameters after the sonar-wrapper are used for the sonar-scanner call +
-      # additional we configure sonar-scanner to use config file ".sonar-project.properties" (dot) +
-      # -X is used for sonar-scanner and sonar-wrapper for trace output +
-      - chmod 0777 .sonar-wrapper +
-      - ./.sonar-wrapper -X  allow_failure: true +
-  </code>We use the .sonar-wrapper script in the project main branch to configure files without extensions+