Add sonarqube for PRs (#755)

* Add sonarqube for PRs

Signed-off-by: Jeroen Laverman <jeroen.laverman@bosch-si.com>

* fix path to script

Signed-off-by: Jeroen Laverman <jeroen.laverman@bosch-si.com>

* Rename Token

Signed-off-by: Jeroen Laverman <jeroen.laverman@bosch-si.com>

* fix script

Signed-off-by: Jeroen Laverman <jeroen.laverman@bosch-si.com>
This commit is contained in:
Jeroen Laverman
2018-10-16 15:37:52 +02:00
committed by Dominic Schabel
parent f40f388158
commit bcdfed8511
2 changed files with 7 additions and 19 deletions

View File

@@ -37,7 +37,7 @@ jobs:
# Run tests
- run:
name: Test incl. license verification
command: mvn verify license:check
command: './.circleci/sonarCircleCi.sh'
# Record test results
- run: mkdir -p testresults/junit/

24
.circleci/sonarCircleCi.sh Normal file → Executable file
View File

@@ -8,23 +8,11 @@
# http://www.eclipse.org/legal/epl-v10.html
#
echo $CI_PULL_REQUEST pull request
# regular sonar on master
if [ "$CIRCLE_BRANCH" = "master" ]; then
mvn verify license:check sonar:sonar -Dsonar.login=$SONAR_SERVER_TOKEN
# preview in case of pull request - disabled as circle does not fill those with pull reuqests from different directories
#echo "$CIRCLE_PULL_REQUEST pull request"
# Run SonarQube only for master branch
if [ $CIRCLE_BRANCH = master ] ; then
mvn verify license:check sonar:sonar -Dsonar.login=$SONAR_ACCESS_TOKEN --batch-mode
else
#if [ -n "$CI_PULL_REQUEST" ]; then
# mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify license:check sonar:sonar -B -e -V \
# -Dclirr=true \
# -Dsonar.analysis.mode=issues \
# -Dsonar.github.pullRequest=`echo $CI_PULL_REQUEST| awk -F'/' '{print $7}'` \
# -Dsonar.github.login=$SONAR_GITHUB_LOGIN \
# -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \
# -Dsonar.login=$SONAR_SERVER_USER \
# -Dsonar.password=$SONAR_SERVER_PASSWD
#else
mvn verify license:check
#fi
mvn verify license:check --batch-mode
fi
# but noting in case of other branches