我配置詹金斯与sonarqube扫描仪一起工作。扫描工作正常。詹金斯管道正在工作,我在詹金斯日志中没有任何问题。Sonarqube质量门不发送webhook詹金斯
SonarQube扫描仪3.0.3.778 詹金斯:2.70 SonarQube扫描仪詹金斯插件: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 != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
我的问题来自质量门。它从不将json有效载荷发布给jenkins。我在jenkins日志里没有看到json条目。但我知道jenkins和sonarqube服务器之间的连接正在工作,因为我能够使用sonarqube VM中的curl发送POST。
这里詹金斯作业输出:
Timeout set to expire in 15 min
[Pipeline] {
[Pipeline] waitForQualityGate
Checking status of SonarQube task 'AV3irVJXpvBxXXNJYZkd' on server 'mscodeanalysis'
SonarQube task 'AV3irVJXpvBxXXNJYZkd' status is 'PENDING'
Cancelling nested steps due to timeout
这里是我的有效载荷是永远达不到詹金斯管道: 网址:http://sonar-server:9000/api/ce/task?id=AV3irVJXpvBxXXNJYZkd
{"task":{"organization":"default-organization","id":"AV3irVJXpvBxXXNJYZkd","type":"REPORT","componentId":"AV3hrJeCfL_nrF2072FH","componentKey":"POOL-003","componentName":"POOL-003","componentQualifier":"TRK","analysisId":"AV3irVkZszLEB6PsCK9X","status":"SUCCESS","submittedAt":"2017-08-14T21:36:35+0000","submitterLogin":"jenkins","startedAt":"2017-08-14T21:36:37+0000","executedAt":"2017-08-14T21:36:38+0000","executionTimeMs":650,"logs":false,"hasScannerContext":true}}
我不能插入图像,但质量门是通分析任务就是成功。
让我知道是否需要包含更多信息。 谢谢
验证:你_did_配置一个webhook发回服务器端处理结束詹金斯吧? –
是的,我在这个页面上配置webhook:http:// sonarqube-servert:9000/settings?category = webhooks把nameL詹金斯和url:https://jenkins-int.domain.com/sonarqube-webhook/ – Marc
你的日志显示webhook正在被解雇?另外,两个盒子之间是否有代理或防火墙? –