简体   繁体   English

詹金斯 waitForQualityGate 错误的 id

[英]Jenkins waitForQualityGate wrong id

I'm trying to integrate Sonarqube in my Jenkins pipeline, all works fine untile gateway checks.我正在尝试将 Sonarqube 集成到我的 Jenkins 管道中,在网关检查之前一切正常。

 stage('Sonar') { steps { withSonarQubeEnv(installationName: 'Sonarqube', credentialsId: 'sonar') { sh "$SCANNER_HOME/bin/sonar-scanner -D'sonar.projectKey=$JOB_NAME'" } } } stage("Quality Gate") { steps { timeout(time: 1, unit: 'HOURS') { waitForQualityGate abortPipeline: true } } }

withSonarQubeEnv reports an id, for example: AXyPGkHZtOM2BAFbSUcX . withSonarQubeEnv 报告一个 id,例如: AXyPGkHZtOM2BAFbSUcX 。 Using api/ce/task?id=AXyPGkHZtOM2BAFbSUcX I can see process status and analysisId(fe AXyPGkmqJtbgJ09MpQ6B) The point is that waitForQualityGate alway reads api/qualitygates/project_status?analysisId=AXyLfj5JlX0w7MRERt_e resulting in a 404. I'm on that from something like 5 h and can't get out.使用api/ce/task?id=AXyPGkHZtOM2BAFbSUcX我可以看到进程状态和 analysisId(fe AXyPGkmqJtbgJ09MpQ6B) 关键是 waitForQualityGate api/qualitygates/project_status?analysisId=AXyLfj5JlX0w7MRERt_e读取api/qualitygates/project_status?analysisId=AXyLfj5JlX0w7MRERt_e 5小时,出不去。 Someone has ideas?有人有想法吗?

The stages look fine, the HTTP 404 issue is due SonarQube not understanding the projectKey by the looks of it, from above you have -D'sonar.projectKey=$JOB_NAME' .阶段看起来很好,HTTP 404 问题是由于 SonarQube 不理解 projectKey 的外观,从上面你有-D'sonar.projectKey=$JOB_NAME' The command & variable are defined incorrectly, it should be -Dsonar.projectKey='$JOB_NAME' .命令和变量定义不正确,应该是-Dsonar.projectKey='$JOB_NAME'

That way the SonarQube server will be able to send analysis back to the Jenkins webhook with the correct key这样 SonarQube 服务器将能够使用正确的密钥将分析发送回 Jenkins webhook

I found the problem.我发现了问题。 I moved sonarcube temp files to another location.我将声纳立方体临时文件移动到另一个位置。 Those changes reflect on Jenkins too but plug-in can't handle that so it was looking for file before the temp-dir change.这些更改也反映在 Jenkins 上,但插件无法处理,因此它在 temp-dir 更改之前寻找文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM