3

I am trying to add SonarQube analysis to our OSS Project with travis on Github.

I performed the following steps:

  1. Create a organization and project on sonarcloud.io
  2. Add the sonarcloud definition in .travis.yml
  3. Create a sonar-project.properties file
  4. Push everything to a feature branch called feature/sonarcloud
  5. Add this branch to travis.yml and properties file.

The final result can be seen here: https://github.com/open62541/open62541/tree/feature/sonarcloud

Unfortunately Travis does not submit the sonar analysis:

INFO: Scanner configuration file:
/home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner analysis skipped

(See also https://travis-ci.org/open62541/open62541/jobs/287631673)

I already tried to forcefully set export SONARQUBE_SKIPPED=false but it is still skipped. How can I find out why the scanner analysis is skipped?


Related questions:

Stefan Profanter
  • 6,458
  • 6
  • 41
  • 73

1 Answers1

2

As you can read in the Travis CI logs, at line 556:

Skipping SonarCloud Scan because this branch is not master or it does not match declared branches

This is because you haven't activated analysis on that "feature/sonarcloud" branch. As described in the official documentation, you can achieve that like this:

  addons:
    sonarcloud:
      organization: open62541
      token:
        secure: "..."
      branches:
        - master
        - feature/sonarcloud
  • I already added the branch to the branches list. See: https://github.com/open62541/open62541/blob/feature/sonarcloud/.travis.yml#L64 Or am I missing something? – Stefan Profanter Oct 14 '17 at 13:51
  • 1
    @SailAvid the branches key has the wrong level of indentation in the blob you link there. It sits beside sonarcloud, instead of beside organization and token. – flup Mar 22 '18 at 23:10
  • Got it running. See: https://github.com/open62541/open62541/pull/1690/commits/ea95551d989892a48072bc353696f5b8538010c1 – Stefan Profanter Mar 27 '18 at 07:20