Skip to content

Instantly share code, notes, and snippets.

@prashanth-sams
Forked from guiwoda/sonar.sh
Created January 23, 2019 14:47
Show Gist options
  • Save prashanth-sams/7bc8b285b97bcdb97ea99d86499c6800 to your computer and use it in GitHub Desktop.
Save prashanth-sams/7bc8b285b97bcdb97ea99d86499c6800 to your computer and use it in GitHub Desktop.
Run sonarqube analysis
#!/bin/bash
if [ "$PULL_REQUEST_NUMBER" == "false" ]; then
~/sonar-scanner/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.analysis.mode=preview \
              -Dsonar.github.repository=$SEMAPHORE_REPO_SLUG \
              -Dsonar.github.oauth=$GITHUB_TOKEN \
              -Dsonar.host.url=$SONAR_HOST_URL \
              -Dsonar.login=$SONAR_TOKEN
else
~/sonar-scanner/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.analysis.mode=preview \
-Dsonar.github.pullRequest=$PULL_REQUEST_NUMBER \
              -Dsonar.github.repository=$SEMAPHORE_REPO_SLUG \
              -Dsonar.github.oauth=$GITHUB_TOKEN \
              -Dsonar.host.url=$SONAR_HOST_URL \
              -Dsonar.login=$SONAR_TOKEN
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment