forked from RedHatInsights/edge-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsonarqube_exec.sh
executable file
·45 lines (33 loc) · 1.16 KB
/
sonarqube_exec.sh
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
43
44
45
#!/bin/bash
set -o nounset
if [ -w "${HOME}/passwd" ];
then
sed "/^jboss/s/[^:]*/$(id --user)/3" /etc/passwd > "${HOME}/passwd"
fi
if [ -w "${HOME}/group" ];
then
sed "/^jboss/s/[^:]*/$(id --group)/3" /etc/group > "${HOME}/group"
fi
KEYSTORE="${PWD}/sonarqube/store/RH-IT-Root-CA.keystore"
"${JAVA_HOME}/bin/keytool" \
-keystore "${KEYSTORE}" \
-import \
-alias "RH-IT-Root-CA" \
-file "/${PWD}/sonarqube/certs/RH-IT-Root-CA.crt" \
-storepass "${KEYSTORE_PASSWORD}" \
-noprompt
export SONAR_SCANNER_OPTS="-Djavax.net.ssl.trustStore=${KEYSTORE} -Djavax.net.ssl.trustStorePassword=${KEYSTORE_PASSWORD}"
export PATH="${PWD}/sonarqube/extract/${SONAR_SCANNER_NAME}/bin:${PATH}"
export SONAR_USER_HOME='/tmp'
APP='edge-api'
SONAR_APP_DIR="${SONAR_USER_HOME}/${APP}"
mkdir "${SONAR_APP_DIR}"
cp -R '/home/jboss' "${SONAR_APP_DIR}"
cd "${SONAR_USER_HOME}" || exit 1
sonar-scanner \
-Dsonar.projectKey='console.redhat.com:fleet-management' \
-Dsonar.sources="./${APP}" \
-Dsonar.host.url="${SONARQUBE_REPORT_URL}" \
-Dsonar.projectVersion="${COMMIT_SHORT}" \
-Dsonar.go.coverage.reportPaths="./${APP}/coverage.txt" \
-Dsonar.login="${SONARQUBE_TOKEN}"