【发布时间】:2020-07-05 03:28:20
【问题描述】:
我们在 SonarQube 中运行由 Azure DevOps 中的管道触发的自动代码质量扫描:
# retrieve and build code, run unit tests etc.
- task: SonarQubePrepare@4
displayName: 'Prepare SonarQube Scan'
inputs:
SonarQube: 'SonarQube DevOps Connection'
scannerMode: 'CLI'
configMode: 'file'
- task: SonarQubeAnalyze@4
displayName: 'Run SonarQube Scan'
- task: SonarQubePublish@4
displayName: 'Publish SonarQube Scan Report'
inputs:
pollingTimeoutSec: '300'
大约一周前,所有管道的主要分析任务('Run SonarQube Scan')开始失败,并出现以下错误:
...
##[error]ERROR: Error during SonarQube Scanner execution
ERROR: Error during SonarQube Scanner execution
##[error]java.lang.IllegalStateException: Unable to load properties from file /home/vsts/work/1/s/.scannerwork/report-task.txt
java.lang.IllegalStateException: Unable to load properties from file /home/vsts/work/1/s/.scannerwork/report-task.txt
...
##[error]Caused by: java.io.FileNotFoundException: /home/vsts/work/1/s/.scannerwork/report-task.txt (No such file or directory)
Caused by: java.io.FileNotFoundException: /home/vsts/work/1/s/.scannerwork/report-task.txt (No such file or directory)
...
我们没有对我们的管道进行任何更改,所以我对导致这种更改的原因感到困惑。
我们正在使用 SonarQube Enterprise EditionVersion 7.9.1(内部版本 27448)(内部安装)和用于 Azure DevOps 的 SonarQube 扩展 4.9.0 版(由 SonarSource 发布)。
25/3/20 更新(感谢 patricklu-msft):
我们正在使用带有 ubuntu-16.04 映像的 Microsoft 托管的构建代理。在调试模式下运行管道会显示以下内容:
2020-03-25T14:25:00.3694399Z 14:25:00.369 DEBUG: Report metadata written to /home/vsts/work/_temp/sonar/20200325.2/eec0f38a-913b-3db3-e1b2-71091ea5f860/report-task.txt
看来报告元数据正在写入/home/vsts/work/_temp/sonar/20200325.2/eec0f38a-913b-3db3-e1b2-71091ea5f860/report-task.txt,但SonarQube 随后在/home/vsts/work/1/s/.scannerwork/report-task.txt 中查找它们。看起来某处缺少mv 操作...
【问题讨论】:
-
您使用的是哪种构建代理?主机或自主机代理?建议您在管道中也启用
system.debug=true变量,检查您是否获得更多详细信息以进行故障排除。 -
@PatrickLu-MSFT - 感谢您的建议。我将在上面的描述中添加额外的信息。