Skip to content

Commit 5890edb

Browse files
authored
Update sonarqube.yml
1 parent 68bc13b commit 5890edb

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

.github/workflows/sonarqube.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,34 @@ jobs:
3434
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3535
# SONAR_HOST_URL: https://sonarqube.k8s-ants.inf.um.es
3636

37+
- name: Debug Java path
38+
run: |
39+
readlink -f $(which java)
40+
3741
- name: Import certificate into Java keystore
3842
run: |
39-
sudo keytool -importcert \
40-
-noprompt \
41-
-trustcacerts \
42-
-alias sonarqube-cert \
43-
-file sonarqube.crt \
44-
-keystore /usr/lib/jvm/java-17-adoptopenjdk/lib/security/cacerts \
45-
-storepass changeit || \
46-
sudo keytool -importcert \
47-
-noprompt \
48-
-trustcacerts \
49-
-alias sonarqube-cert \
50-
-file sonarqube.crt \
51-
-keystore /usr/lib/jvm/java-17-openjdk-amd64/lib/security/cacerts \
52-
-storepass changeit
43+
for CACERTS in \
44+
/usr/lib/jvm/java-17-adoptopenjdk/lib/security/cacerts \
45+
/usr/lib/jvm/java-17-openjdk-amd64/lib/security/cacerts \
46+
/usr/lib/jvm/temurin-17*/lib/security/cacerts \
47+
/usr/lib/jvm/java-17-*/lib/security/cacerts
48+
do
49+
if [ -f "$CACERTS" ]; then
50+
echo "Importing into: $CACERTS"
51+
sudo keytool -importcert \
52+
-noprompt \
53+
-trustcacerts \
54+
-alias sonarqube-cert \
55+
-file sonarqube.crt \
56+
-keystore "$CACERTS" \
57+
-storepass changeit
58+
exit 0
59+
fi
60+
done
61+
62+
echo "ERROR: No valid Java cacerts found"
63+
exit 1
64+
5365

5466
- name: List trusted certs (optional debug)
5567
run: |

0 commit comments

Comments
 (0)