SonarQube Pull Request Decoration with Azure DevOps

  • Running SonarQube 8.1 Developer Edition on a local Server behind a firewall (http.proxyHost, http.proxyPort, https.proxyHost, https.proxyPort configured)
  • The Source Code is stored on Azure DevOps Services and the Build Pipeline is configured in the cloud.
  • I’m trying to set up the Pull Request Decoration in Azure DevOps. Unfortunately SonarQube seems to have a problem updating the PR Decoration in Azure DevOps.
  • I set the logging to trace and received the following logs (changes AzureDevOps URL and Proxy).
  • The proxy port is never mentioned in the log?!

2020.02.13 14:45:35 WARN ce[AXA-zASdMJlSVH01T07r][c.s.C.D.C.C] Failed to decorate Azure DevOps Pull Request
com.microsoft.alm.client.model.VssResourceNotFoundException: API resource location 225f7195-f9c7-4d14-ab28-a83f7ff77e1f is not registered on https://test.visualstudio.com/. java.net.UnknownHostException: http://192.1.1.1
at com.microsoft.alm.client.DefaultRestClientHandler.createTarget(DefaultRestClientHandler.java:125)
at com.microsoft.alm.client.DefaultRestClientHandler.createRequest(DefaultRestClientHandler.java:85)
at com.microsoft.alm.client.VssHttpClientBase.createRequest(VssHttpClientBase.java:200)
at com.microsoft.alm.client.VssHttpClientBase.createRequest(VssHttpClientBase.java:104)
at com.microsoft.alm.teamfoundation.sourcecontrol.webapi.GitHttpClientBase.getRepository(GitHttpClientBase.java:16284)
at com.sonarsource.C.D.C.G.A(Unknown Source)
at com.sonarsource.C.D.C.C.A(Unknown Source)
at com.sonarsource.C.D.C.C.A(Unknown Source)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at com.sonarsource.C.D.C.C.A(Unknown Source)
at com.sonarsource.C.D.a.A(Unknown Source)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at com.sonarsource.C.D.a.B(Unknown Source)
at com.sonarsource.C.D.a.A(Unknown Source)
at org.sonar.ce.async.SynchronousAsyncExecution.addToQueue(SynchronousAsyncExecution.java:27)
at com.sonarsource.C.D.a.A(Unknown Source)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at com.sonarsource.C.D.a.finished(Unknown Source)
at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:118)
at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:109)
at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:91)
at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:63)
at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:209)
at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:191)
at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:158)
at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.ws.rs.ProcessingException: java.net.UnknownHostException: http://192.1.1.1
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:294)
at org.glassfish.jersey.client.ClientRuntime.lambda$null$3(ClientRuntime.java:187)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:312)
at org.glassfish.jersey.client.ClientRuntime.lambda$createRunnableForAsyncProcessing$4(ClientRuntime.java:163)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
… 3 common frames omitted
Caused by: java.net.UnknownHostException: http://192.1.1.1
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:220)
at java.base/java.net.Socket.connect(Socket.java:608)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:526)
at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:524)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:523)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:564)
at java.base/sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:265)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1071)
at java.base/sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1069)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:795)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1068)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)
at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1507)
at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1505)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:795)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1504)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:390)
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:292)
… 13 common frames omitted
2020.02.13 14:45:35 TRACE ce[AXA-zASdMJlSVH01T07r][sql] time=0ms | sql=update project_branches set merge_branch_uuid = ?, pull_request_binary = ?, updated_at = ? where uuid = ? | params=AWjmv6QArGAxCuOsTWFa, [B@326a96ab, 1581601535575, AXA-tz7LMJlSVH01T07m 2020.02.13 14:45:35 INFO ce[AXA-zASdMJlSVH01T07r][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=63ms

Hello,

Below looks strange:

API resource location 225f7195-f9c7-4d14-ab28-a83f7ff77e1f is not registered on [https://test.visualstudio.com/ ](https://test.visualstudio.com/). java.net.UnknownHostException: [http://192.1.1.1](http://192.1.1.1/)

Unknown host exception and pointing to 192.1.1.1 - you need to check your DNS settings I believe.

Greetings
Kris

Hi Kris,
the mentioned IP is the address of our proxy server (I’ve changed it from our local IP to 192.1.1.1 in the log)
Therefore I don’t think that it’s related to our DNS settings.

The only thing which is looking strange is that I’ve configured the http(s)ProxyHost and http(s)ProxyPort, but the port is not shown in the log. Could that course the problem?

Thanks,
Stefan

Hello Stefan.

The only thing which is looking strange is that I’ve configured the http(s)ProxyHost and http(s)ProxyPort, but the port is not shown in the log. Could that course the problem?

At which layer, have you configured those settings, the sonar.properties config file?
It is the Compute Engine JVM that attempts to decorate the PR so those settings, assuming they are correct, need to be available to CE.

Hope that helps.
Kris

Hi Kris,

yes, it is configured in the sonar.properties file.

How can make these settings available to CE?

Hi Kris,

I just checked SonarQube again. The proxy should already be available to the CE.

jvm 1    | 2020.02.18 13:55:31 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [G:\SonarQube\sonarqube-developer-8.1.0.31237]: C:\Program Files\Java\jdk-11.0.5\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=G:\SonarQube\sonarqube-developer-8.1.0.31237\temp --add-opens=java.base/java.util=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.proxyHost=172.28.64.68 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.*|[::1] -Dhttps.proxyHost=172.28.64.68 -Dhttps.proxyPort=8080 -cp ./lib/common/*;G:\SonarQube\sonarqube-developer-8.1.0.31237\lib\jdbc\postgresql\postgresql-42.2.8.jar org.sonar.ce.app.CeServer G:\SonarQube\sonarqube-developer-8.1.0.31237\temp\sq-process12807933216755088244properties