【发布时间】:2017-06-13 15:07:18
【问题描述】:
我在 Visual Studio Team Services 中的 SonarQube Scanner for MSBuild - End Analysis 构建任务中遇到以下错误。
2017-06-12T14:35:00.1131070Z SonarQube found 7 issues out of which 1 are new
2017-06-12T14:35:00.1131070Z
2017-06-12T14:35:00.1443593Z
2017-06-12T14:35:00.1599853Z ##[error]System.Management.Automation.RuntimeException: Internal Error: expected E:\\CI02\16\s to be a parent of E:\CI02\16\s\path\to\my\file.cs ---> System.Management.Automation.RuntimeException: Internal Error: expected E:\\CI02\16\s to be a parent of E:\CI02\16\s\path\to\my\file.cs
2017-06-12T14:35:00.1599853Z --- End of inner exception stack trace ---
2017-06-12T14:35:00.1599853Z at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-06-12T14:35:00.1599853Z at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-06-12T14:35:00.1599853Z at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-06-12T14:35:00.1599853Z at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-06-12T14:35:00.1599853Z at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-06-12T14:35:00.1599853Z at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-06-12T14:35:00.1756102Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-06-12T14:35:00.1756102Z ##[section]Finishing: Complete the SonarQube analysis
从日志中可以看出,它失败了,因为E:\\CI02\16\s 不是E:\CI02\16\s\path\to\my\file.cs 的父级(注意E: 后面的反斜杠数量不同)。
通过查看构建任务的source code,我可以看到它期望文件路径以Build.Repository.LocalPath 任务上下文变量的值开头。我不明白为什么斜线的数量会有所不同。
这仅在从拉取请求触发构建时发生。如果我手动排队构建它会成功而没有问题。
我使用的是 SonarQube for Team Services 的 2.1.2 版。
有人知道解决此问题的方法或有任何建议吗?
【问题讨论】:
标签: sonarqube sonarqube-scan azure-pipelines-build-task