当前位置:网站首页>Gerrit triggers Jenkins sonarqube scan

Gerrit triggers Jenkins sonarqube scan

2022-06-12 17:06:00 @TangXin

Environmental reference :Gerrit+2 Trigger Jenkins Mission
describe : Record Gerrit +2 After the operation , Automatic triggering Jenkins Execution of works ,SonarQube The tool statically scans the code , If the scan is successful ,Gerrit Automatically +1, If the scan fails ,Gerrit Automatically -1

1.Jenkins To configure

Jenkins Middle configuration Gerrit Trigger, When Jenkins The task was executed successfully ,Gerrit Code Review +1, When Jenkins Task execution failed ,Gerrit Code Review -1
 Insert picture description here

2.Jenins- structure

sonar.projectKey=test1
sonar.projectName=test1
sonar.sourceEncoding=UTF-8
sonar.projectVersion=${BUILD_TAG}
sonar.language=python
sonar.sources=${WORKSPACE}/test
sonar.projectBaseDir=${WORKSPACE}/test
sonar.qualitygate.wait=true
sonar.qualitygate.timeout=3000

 Insert picture description here

3.SonarQube Set quality threshold

SonarQube After setting the quality threshold for the project ,Jenkins in SonarQube When the task is executed , If the quality threshold is met , be Jenkins The task was executed successfully , Otherwise, the execution fails .
 Insert picture description here

Gerrit+2 after , Automatic triggering Jenkins in SonarQube Task execution , When the quality threshold setting is not satisfied , Task execution failed
 Insert picture description here

SonarQube Page shows , New code scan failed
 Insert picture description here

4.Gerrit Show

Gerrit -1 operation
 Insert picture description here

原网站

版权声明
本文为[@TangXin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121645542590.html