我将Jenkins配置为与声纳扫描仪一起使用。扫描工作正常。jenkins管道正在运行,并且在jenkins日志中没有任何问题。
SonarQube Scanner 3.0.3.778 Jenkins:2.70 SonarQube Scanner for Jenkins插件:2.6.1
我使用以下代码:
stage('SonarQube analysis') {
sh 'sed -ie "s|_PROJECT_|${PROJECT_CODE}|g" $WORKSPACE/_pipeline/sonar-project.properties'
// requires SonarQube Scanner 3.0+
def scannerHome = '/opt/sonar/bin/sonar-scanner';
withSonarQubeEnv('mscodeanalysis') {
sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=$WORKSPACE/_pipeline/sonar-project.properties"
}
}
}
}
}
}
// No need to occupy a node
stage("Quality Gate"){
timeout(time: 15, unit: 'MINUTES') { // Just in case something goes wrong, pipeline will be killed after a timeout
def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
if (qg.status != …Run Code Online (Sandbox Code Playgroud)