Skip to content

Instantly share code, notes, and snippets.

@guiwoda
Last active January 23, 2019 14:47
Show Gist options
  • Save guiwoda/b71fcabb6fd1a66200d5b2958d63f807 to your computer and use it in GitHub Desktop.
Save guiwoda/b71fcabb6fd1a66200d5b2958d63f807 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