Skip to content

Commit a8c5b90

Browse files
committed
Automatically detect 9.9 and set external issues format and scanner token param
1 parent 9ffac23 commit a8c5b90

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

conf/scan.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ else
3131
localbuild="false"
3232
fi
3333

34-
external_format="v2"
34+
if [[ "${SONAR_HOST_URL}" = "${SONAR_HOST_URL_9}" ]]; then
35+
external_format="v1"
36+
auth="-Dsonar.login=${SONAR_TOKEN}"
37+
else
38+
external_format="v2"
39+
auth=""
40+
fi
41+
42+
3543

3644
scanOpts=()
3745

@@ -46,6 +54,7 @@ do
4654
;;
4755
-9)
4856
external_format="v1"
57+
auth="-Dsonar.login=${SONAR_TOKEN}"
4958
;;
5059
-local)
5160
localbuild="true"
@@ -79,13 +88,9 @@ version=$(grep PACKAGE_VERSION "${ROOTDIR}/sonar/version.py" | cut -d "=" -f 2 |
7988
cmd="sonar-scanner -Dsonar.projectVersion=${version} \
8089
-Dsonar.python.flake8.reportPaths=${flake8Report} \
8190
-Dsonar.python.pylint.reportPaths=${pylintReport} \
82-
-Dsonar.token=${SONAR_TOKEN} \
91+
-Dsonar.token=${SONAR_TOKEN} ${auth}\
8392
"${scanOpts[*]}""
8493

85-
if [[ "${SONAR_HOST_URL}" = "${SONAR_HOST_URL}_9" ]]; then
86-
cmd="${cmd} -Dsonar.login=${SONAR_TOKEN}"
87-
fi
88-
8994
if ls "${buildDir}"/coverage*.xml >/dev/null 2>&1; then
9095
cmd="${cmd} -Dsonar.python.coverage.reportPaths=${buildDir}/coverage*.xml"
9196
else

0 commit comments

Comments
 (0)