Azure Devops with Git enterprise configuration issues

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    7.9, I think we have most of the plugins installed.

  • what are you trying to achieve
    I am trying to get SonarQube to work with Azure Devops, but always get weirdness… I must have my confif wrong…

  • what have you tried so far to achieve this
    Everything! - but here is my config

    • task: SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@4
      displayName: ‘Prepare analysis on SonarQube Pull Requests’
      condition: and (
      eq(variables[‘Build.Reason’], ‘PullRequest’),
      ne(variables[‘Build.SourceBranch’], ‘refs/heads/dev’)
      )
      inputs:
      SonarQube: SonarQube
      projectKey: hram
      projectName: hram-upgrade
      projectVersion: '(Build.BuildId)' extraProperties: | sonar.sourceEncoding=UTF-8 sonar.tsql.file.suffixes=.tsql,.sql sonar.links.ci=<CI URL> sonar.links.scm=<REPO URL> sonar.links.issues=<ISSUES URL> sonar.scm.provider=git sonar.cs.vscoveragexml.reportsPaths=**/*.coveragexml sonar.pullrequest.key=(System.PullRequest.PullRequestNumber)
      sonar.pullrequest.base=refs/heads/(System.PullRequest.TargetBranch) sonar.pullrequest.branch=refs/heads/(System.PullRequest.SourceBranch)
      sonar.pullrequest.github.repository=
      sonar.github.oauth=
      sonar.github.repository=(Build.Repository.Name) sonar.github.pullRequest=(System.PullRequest.PullRequestNumber)
      sonar.github.endpoint=
      sonar.exclusions=/test//,/src/Sources//,

    • task: SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@4
      displayName: ‘Prepare analysis on SonarQube’
      condition: ne(variables[‘Build.Reason’], ‘PullRequest’)
      inputs:
      SonarQube: SonarQube
      projectKey: hram
      projectName: hram-upgrade
      projectVersion: ‘$(Build.BuildId)’
      extraProperties: |
      sonar.sourceEncoding=UTF-8
      sonar.tsql.file.suffixes=.tsql,.sql
      sonar.links.ci=
      sonar.links.scm=
      sonar.links.issues=
      sonar.scm.provider=git
      sonar.cs.vscoveragexml.reportsPaths=/*.coveragexml
      sonar.exclusions=
      /test//*,/src/Sources/**/*,

Some of the behaviours i see is;

  1. The PR decoration doesnt work;
  2. Quite often nothing gets flagged between source and target
  3. When manually running a branch, it will fail with null exception

Any pointers would be great!

Hello Nick and welcome to our forum!

Which edition of SonarQube are you using ?
PR decoration is only available starting from the Developer Edition.

I’m not sure I understand what you mean by that. Could you please elaborate ?

Could you please share the exact scenario and full logs to get a better idea of what could go wrong.

Thanks,
-Chris

Hey Christophe

Sorry for the delay in reply! - and thansk fro getting back to me!

Version: Enterprise Edition Version 7.9 (build 26994)

So for Number 2 - We quite often see this

But its weird, as I know theres thousands of new lines of code in that PR… so for it to show nothing is odd.

I have also been seeing this alot recently;

In terms of the NullException, if i see it again i will attach a log.

Hope you can help.
N