【问题标题】:Sonarqube "Failed to create an empty directory" when scanning multiple projects in one VSTS build definition在一个 VSTS 构建定义中扫描多个项目时,Sonarqube“无法创建空目录”
【发布时间】:2021-10-01 01:39:46
【问题描述】:

我需要在每晚构建定义中为多个项目运行 sonarqube。我发现的问题是 - 在为第一个项目成功运行 sonarqube 后,创建了一个 .sonarqube 文件夹,并且一个进程似乎继续使用该文件夹。因此,该文件夹无法被后续项目删除/使用。有没有办法解决这个问题?

第二个项目的准备步骤出错:

2017-06-08T22:43:53.0910761Z ##[error]Failed to create an empty directory 'C:\VSTS-Agent-2.104.0\_work\3\.sonarqube'. Please check that there are no open or read-only files in the directory and that you have the necessary read/write permissions.
2017-06-08T22:43:53.0910761Z ##[error]Detailed error message: The process cannot access the file 'newSummaryReport.md' because it is being used by another process.
2017-06-08T22:43:53.0910761Z ##[error]Pre-processing failed. Exit code: 1
2017-06-08T22:43:53.0910761Z ##[error]System.Exception: Unexpected exit code received from batch file: 1
2017-06-08T22:43:53.0910761Z    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeBatchScriptCmdlet.ProcessRecord()
2017-06-08T22:43:53.0910761Z    at System.Management.Automation.CommandProcessor.ProcessRecord()
2017-06-08T22:43:53.1066882Z ##[error]PowerShell script completed with 1 errors.

【问题讨论】:

  • 我无法重现此问题,请尝试删除 3 个文件夹 (_work\3) 并重试。此外,使用另一个构建代理重试并检查结果。另一方面,您可以在 OneDrive 上共享详细的构建日志。
  • 我可以不断重现该问题,但似乎进程/文件锁定是暂时的。说项目 2 的 sonarqube 失败了,项目 3 就可以了。我正在考虑在两者之间添加一个 powershell 脚本来等待文件锁的释放。我猜这可能与项目规模有关?
  • 你能用简单的项目重现这个问题吗?这些项目的规模有多大?
  • 我也遇到了这个问题。
  • 我对 onprem TFS 2018 有同样的问题。

标签: sonarqube azure-pipelines


【解决方案1】:

我绕过这个问题:

  • 通过在"Prepare analysis on SonarQube" 任务之前向管道添加删除文件任务;
  • 删除".sonarqube\out\" 文件夹。源文件夹"$(Agent.BuildDirectory)\.sonarqube\out\";
  • 请务必提前查看"Remove files starting with a dot"。

【讨论】:

    猜你喜欢
    • 2019-01-07
    • 2016-03-30
    • 2017-12-06
    • 1970-01-01
    • 2018-03-07
    • 2017-09-08
    • 2016-08-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多