Reputation: 50
within a VSTS Build Definition when using the "Prepare anylasis on SonarQube". we are trying to pass the $(System.PullRequest.PullRequestNumber) into the Additional options like such
sonar.github.oauth=****
sonar.github.repository=****
sonar.github.pullRequest=$(System.PullRequest.PullRequestNumber)
sonar.analysis.mode=preview
however when the "Run Code Analysis" step is run, the following error is throw.
2018-04-10T22:26:56.9961964Z ERROR: Error during SonarQube Scanner execution
2018-04-10T22:26:56.9977598Z ERROR: Failed to execute project builder: org.sonar.plugins.github.PullRequestProjectBuilder
2018-04-10T22:26:56.9978166Z ERROR: Caused by: For input string: "$(System.PullRequest.PullRequestNumber)"
our source is in github hence the use of System.PullRequest.PullRequestNumber
instead of System.PullRequest.PullRequestId
which also fails when Source is Pulled from VSTSs Git Repo.
SonarQube 7.0.
Upvotes: 1
Views: 521
Reputation: 5326
I'm not sure variables are interpolated by VSTS in multi-line fields.
You can try sonar.github.pullRequest=${env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}
to have the scanner read the value from the environment.
Upvotes: 1