Created
July 21, 2018 20:19
-
-
Save manuc66/f42ddeab2e5bde59a1e22f1ee3afa2e4 to your computer and use it in GitHub Desktop.
SonarQube TeamCity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -v | |
# if [ `git symbolic-ref --short HEAD` = "develop" ]; then | |
if [ -f "./sonar-project.properties" ]; then | |
wget -nc https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-%sonar_version%-linux.zip -P /tmp/ | |
if [ ! -d /tmp/sonar-scanner-%sonar_version%-linux/ ]; then | |
unzip /tmp/sonar-scanner-cli-%sonar_version%-linux.zip -d /tmp/ | |
fi | |
BRANCH="%teamcity.build.branch%" | |
SONAR_PR="" | |
if [[ $BRANCH == "pull-requests"* ]] ; | |
then | |
PR_ID=`echo $BRANCH | sed 's/pull-requests\///g'` | |
SONAR_PR="-Dsonar.analysis.mode=issues -Dsonar.stash.notification=true -Dsonar.stash.project=%bitbucket.project% -Dsonar.stash.repository=%MODULE_NAME% -Dsonar.stash.pullrequest.id=$PR_ID -Dsonar.stash.password=%GIT_PASSWORD%" | |
fi | |
SONAR_BRANCH="" | |
if [[ $BRANCH != "develop" ]] ; | |
then | |
SONAR_BRANCH="-Dsonar.branch.target=develop -Dsonar.branch.name=$BRANCH" | |
fi | |
/tmp/sonar-scanner-%sonar_version%-linux/bin/sonar-scanner -Dsonar.host.url=%sonar.host.url% -Dsonar.login=%sonar.login% $SONAR_BRANCH $SONAR_PR | |
fi | |
#fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment