TFS2017上的SonarQube分析计时器

问题描述 投票:1回答:2

我们的设置是SonarQube服务器5.6.5 LTS和TFS2017内部部署服务器。

我正在对一个大型解决方案运行代码分析,这个解决方案需要大约15分钟的构建时间,并且几乎同时完成分析构建步骤。在“完成SonarQube分析”构建步骤中,我收到以下错误:

2017-01-31T08:52:44.8355200Z 09:52:44.741  Post-processing succeeded.
2017-01-31T08:52:46.9293440Z Waiting on the SonarQube server to finish processing in order to determine the quality gate status.
2017-01-31T08:57:47.7364532Z ##[error]System.Management.Automation.RuntimeException: The analysis did not complete in the allotted time of 300 seconds. Consider setting the build variable SonarQubeAnalysisTimeoutInSeconds to a higher value. ---> System.Management.Automation.RuntimeException: The analysis did not complete in the allotted time of 300 seconds. Consider setting the build variable SonarQubeAnalysisTimeoutInSeconds to a higher value.
2017-01-31T08:57:47.7364532Z    --- Ende der internen Ausnahmestapelüberwachung ---
2017-01-31T08:57:47.7364532Z    bei System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-01-31T08:57:47.7364532Z    bei System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-01-31T08:57:47.7364532Z    bei System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-01-31T08:57:47.7364532Z    bei System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-31T08:57:47.7364532Z    bei System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-31T08:57:47.7364532Z    bei Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-01-31T08:57:47.7676884Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-01-31T08:57:47.7676884Z ##[section]Finishing: Complete the SonarQube analysis

构建步骤控制选项中的超时设置为零/无限。我在哪里可以设置SonarQubeAnalysisTimeoutInSeconds或者是否有任何其他Timeout设置我应该设置更高?

如果我在准备构建任务中取消选中“在构建摘要中包含完整分析报告”,则构建将运行为绿色。但在两种情况下,SonarQube Sever日志中都有一个OutOfMemoryError

2017.01.31 09:54:10 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=399ms
2017.01.31 09:54:56 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVnzuYyFhG9cSXnted2v
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Unknown Source) ~[na:1.8.0_121]
    at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source) ~[na:1.8.0_121]
    at java.lang.AbstractStringBuilder.append(Unknown Source) ~[na:1.8.0_121]
    at java.lang.StringBuilder.append(Unknown Source) ~[na:1.8.0_121]
    at org.sonar.server.computation.step.DuplicationDataMeasuresStep$DuplicationVisitor.appendDuplication(DuplicationDataMeasuresStep.java:131) ~[sonar-server-5.6.5.jar:na]
...

这2个错误是否相关?

tfs sonarqube msbuild-task tfs2017
2个回答
2
投票

这两个错误是相关的。您的构建任务正在等待服务器响应构建结果,并且由于OutOfMemoryError而没有响应。

要为进程授予更多内存,请编辑$SONARQUBE_HOME/conf/sonar.properties,取消注释sonar.ce.javaOpts行,并根据需要调整值。


1
投票

我们在SQ版本6.4和SonarQube TFS扩展版本SonarSource.sonarqube-3.0.2中没有这个问题。但是我们刚刚升级到SQ v7.0并开始遇到这个问题。

即使在设置构建变量“SonarQubeAnalysisTimeoutInSeconds”之后,也无法正常工作。

错误SonarQubeAnalysisTimeoutInSeconds设置为600,将用于轮询SonarQube任务完成。分析未在600秒的分配时间内完成。考虑将构建变量SonarQubeAnalysisTimeoutInSeconds设置为更高的值。

此致,San

© www.soinside.com 2019 - 2024. All rights reserved.