TFS Pull Request Decoration Not Working

Hi,

We have recently deployed SonarQube 7.7 Developer and are having issues with the TFS Pull Request Decoration not working.

The following has been configured in SonarQube:

General Tab

  • sonar.core.serverBaseURL is set to the base url of SonarQube including the port number

Pull Request Tab

  • sonar.pullrequest.provider is set to VSTS/TFS
  • sonar.pullrequest.vsts.token.secured configured with a TFS User Token

The following has been configured in TFS:

  • A User Token ( created by a BUILTIN Admin) and has been tested with All Scopes enabled and just the Code (read and write) enabled
  • Build for project contains the Prepare Analysis Configuration and Run Code Analysis tasks and are using v4.* of the task.
  • A build policy has been setup on the master branch to use the gated build definition

When the build takes place the required keys in the Run Code Analysis log are shown to be populated (replaced some values below with X’s)

2019-04-10T12:25:09.3251334Z sonar.projectKey=XXXXXXXXXX
2019-04-10T12:25:09.3251334Z sonar.projectName=XXXXXXXXXX
2019-04-10T12:25:09.3251334Z sonar.projectVersion=1.0
2019-04-10T12:25:09.3251334Z sonar.pullrequest.key=25370
2019-04-10T12:25:09.3251334Z sonar.pullrequest.base=master
2019-04-10T12:25:09.3251334Z sonar.pullrequest.branch=sonarqube_test
2019-04-10T12:25:09.3251334Z sonar.pullrequest.provider=vsts
2019-04-10T12:25:09.3251334Z sonar.pullrequest.vsts.instanceUrl=http://XXXXXXXXXX:8080/tfs/DefaultCollection/
2019-04-10T12:25:09.3251334Z sonar.pullrequest.vsts.project=XXXXXXXXXX
2019-04-10T12:25:09.3251334Z sonar.pullrequest.vsts.repository=XXXXXXXXXX

On the SonarQube server in the ce.log file it is reporting the following:

2019.04.09 11:37:57 WARN ce[AWoBrPsJBoXXTLlhWWsC][c.s.C.C.B.C] Failed to decorate VSTS Pull Request: API resource location 225f7195-f9c7-4d14-ab28-a83f7ff77e1f is not registered on http://XXXXXXXXXX:8080/tfs/DefaultCollection/. Failed to convert a response into an exception.
2019.04.09 11:37:57 INFO ce[AWoBrPsJBoXXTLlhWWsC][o.s.c.t.CeWorkerImpl] Executed task | project=XXXXXXXXXX | type=REPORT | pullRequest=25391 | id=AWoBrPsJBoXXTLlhWWsC | submitter=admin | status=SUCCESS | time=1294ms
2019.04.09 11:40:08 INFO ce[o.s.c.t.CeWorkerImpl] Execute task | project=XXXXXXXXXX | type=REPORT | id=AWoBrwIRBoXXTLlhWWsE | submitter=admin

Also from the SonarQube server within Internet Explorer I can access the TFS instance without any issues.

Is anyone able to advise what could be wrong or that I am missing?

Hi,

I am facing a similar issue with SonarQube 7.9 with the same setup on TFS.
Did you manage to fix the problem ?

Thank you.

Hi Benjamin,

We upgraded to TFS 2018.Update3.2 (16.131.28601.4) and this then worked.

Hi Jez, and thank you for your response.

I forgot to mention I was using Azure DeOps Server instead of TFS 2017.

Anyway, I managed to discover the cause of my problem. It was due to my proxy firewall which blocked the request from the SonarQube server to TFS.

If anyone is facing similar issues, try to add your TFS server host name in “http.nonProxyHosts” in your “sonar.properties” file.

1 Like