【问题标题】:Jenkins SonarQube for .NET Core Fails, but powershell script works.NET Core 的 Jenkins SonarQube 失败,但 powershell 脚本有效
【发布时间】:2018-08-06 11:49:26
【问题描述】:

我正在尝试为 SonarQube 分析运行 Jenkins 管道。我编写了一个可以很好地运行分析的 powershell 脚本;但是在管道中运行时,它在end 步骤上失败。

这是来自 PowerShell 的正确结果: https://pastebin.com/eCaDXgmi

这是 Jenkins 的失败结果: https://pastebin.com/mXgTiq5g

这是 PowerShell 脚本的来源:

& 'C:\Program Files (x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SQScannerMSB\SonarQube.Scanner.MSBuild.exe' begin /k:HC /n:HC /v:1.0 /d:sonar.host.url=http://localhost:9000 /d:sonar.login=REDACTED
& 'C:\Program Files\dotnet\dotnet.exe' msbuild /t:Rebuild
& 'C:\Program Files (x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SQScannerMSB\SonarQube.Scanner.MSBuild.exe' end /d:sonar.login=REDACTED

这是相关的 Jenkins 流水线代码:

stage('SonarQube') {
    powershell(returnStdout: true, script: '.\\sonar.ps1')
}

【问题讨论】:

  • 比较环境变量,即比较set的输出。可能存在差异..

标签: powershell jenkins asp.net-core msbuild sonarqube


【解决方案1】:

从日志看来,这可能与Sonarqube with dotnet core works fine on command line but not from Jenkins 中的问题相同,即作为非本地帐户运行。

从 v4.1 开始,MSBuild 扫描程序将在这种情况下发出特定警告 - 请参阅 SonarMSBRU-374

【讨论】:

  • 谢谢!这就是解决方案!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-19
  • 1970-01-01
  • 1970-01-01
  • 2021-09-19
  • 2021-06-02
  • 2011-10-11
相关资源
最近更新 更多