forked from splitio/javascript-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsonar-scanner.sh
More file actions
executable file
·42 lines (38 loc) · 1.2 KB
/
sonar-scanner.sh
File metadata and controls
executable file
·42 lines (38 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#/bin/bash -e
sonar_scanner() {
local params=$@
sonar-scanner \
-Dsonar.host.url='https://sonarqube.split-internal.com' \
-Dsonar.login="$SONAR_TOKEN" \
-Dsonar.ws.timeout='300' \
-Dsonar.sources='src' \
-Dsonar.exclusions='**/__tests__/**' \
-Dsonar.projectName='javascript-client' \
-Dsonar.projectKey='javascript-client' \
-Dsonar.links.ci='https://travis-ci.com/splitio/javascript-client' \
-Dsonar.links.scm='https://github.com/splitio/javascript-client' \
${params}
return $?
}
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
sonar_scanner \
-Dsonar.pullrequest.provider='GitHub' \
-Dsonar.pullrequest.github.repository='splitio/javascript-client' \
-Dsonar.pullrequest.key=$TRAVIS_PULL_REQUEST \
-Dsonar.pullrequest.branch=$TRAVIS_PULL_REQUEST_BRANCH \
-Dsonar.pullrequest.base=$TRAVIS_BRANCH
else
if [ "$TRAVIS_BRANCH" == 'master' ]; then
sonar_scanner \
-Dsonar.branch.name=$TRAVIS_BRANCH
else
if [ "$TRAVIS_BRANCH" == 'development' ]; then
TARGET_BRANCH='master'
else
TARGET_BRANCH='development'
fi
sonar_scanner \
-Dsonar.branch.name=$TRAVIS_BRANCH \
-Dsonar.branch.target=$TARGET_BRANCH
fi
fi