Help about tweeking SonarQube (\w github plugin) in Travis

12 views
Skip to first unread message

sstaf...@kaliop.com

unread,
Feb 6, 2017, 11:41:16 AM2/6/17
to SonarQube
Hello there, 

I'm about to configure SonarQube in an open-source project hosted on Github, and I want to use it for two usages:
 - on pull requests, report bad practices (that part is ok)
 - when pull requests are merged on specific branch, trigger an full analysis report (that part is failing because github plugin is activated) 

To do so, I have a bash script which is ran after my tests in Travis:

if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
  echo "Running sonar scanner in change preview mode"

  sonar-scanner \
    -Dsonar.host.url=$SONAR_URL \
    -Dsonar.analysis.mode=preview \
    -Dsonar.profile=NodeJS \
    -Dsonar.projectVersion=$PACKAGE_VERSION \
    -Dsonar.login=$SONAR_TOKEN \
    -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
    -Dsonar.github.oauth=$SONAR_GITHUB_TOKEN \
    -Dsonar.github.repository=$TRAVIS_REPO_SLUG

elif [ "${TRAVIS_BRANCH}" == "master" ] || [ "${TRAVIS_BRANCH}" == "develop" ]; then
  echo "Running sonar scanner in publish mode"

  sonar-scanner \
    -Dsonar.host.url=$SONAR_URL \
    -Dsonar.analysis.mode=publish \
    -Dsonar.profile=NodeJS \
    -Dsonar.projectVersion=$PACKAGE_VERSION \
    -Dsonar.login=$SONAR_TOKEN \
    -Dsonar.github.pullRequest= \
    -Dsonar.github.oauth= \
    -Dsonar.github.repository=
fi

I didn't have any error in my local environment
I have enabled the Sonar plugin in travis (did a configuration is pushed to sonar-scanner command ? / how to override it ?)

sstaf...@kaliop.com

unread,
Feb 6, 2017, 11:47:30 AM2/6/17
to SonarQube, sstaf...@kaliop.com
Here is my error when running into the elif 
ERROR: Error during SonarQube Scanner execution
ERROR: The GitHub plugin is only intended to be used in preview or issues mode. Please set 'sonar.analysis.mode'.

sstaf...@kaliop.com

unread,
Feb 6, 2017, 12:29:11 PM2/6/17
to SonarQube, sstaf...@kaliop.com
Sorry, 

I've created this support request in stackoverflow

Can close this discussion :D


Le lundi 6 février 2017 17:41:16 UTC+1, sstaf...@kaliop.com a écrit :
Reply all
Reply to author
Forward
0 new messages