Skip to content

Instantly share code, notes, and snippets.

@prashanth-sams
Forked from raincatcher-bot/sonarqube.sh
Created January 23, 2019 14:47
Show Gist options
  • Save prashanth-sams/fc30d76c51fca1d1c0a2fa839e8bf86b to your computer and use it in GitHub Desktop.
Save prashanth-sams/fc30d76c51fca1d1c0a2fa839e8bf86b to your computer and use it in GitHub Desktop.
Run sonarqube analysis on travis via docker image
#!/bin/bash
set -ev
if [ -v SONAR_TOKEN ]; then
docker pull pierrevincent/sonar-runner
SONAR_OPTIONS="-Dsonar.login=$SONAR_TOKEN"
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
SONAR_OPTIONS="$SONAR_OPTIONS -Dsonar.github.oauth=$SONAR_GITHUB -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST -Dsonar.analysis.mode=issues"
fi
docker run --rm -v $(pwd):/data pierrevincent/sonar-runner $SONAR_OPTIONS
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment