Skip to content

Commit 5b83703

Browse files
committed
SQSCANGHA-56 Support GitHub self-hosted runners without keytool
1 parent 94d4f8a commit 5b83703

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ runs:
4242
run: ${GITHUB_ACTION_PATH}/run-sonar-scanner.sh ${{ inputs.args }}
4343
shell: bash
4444
env:
45-
INPUT_PROJECTBASEDIR: ${{ inputs.projectBaseDir }}
45+
INPUT_PROJECTBASEDIR: ${{ inputs.projectBaseDir }}
46+
SONAR_SCANNER_JRE: ${RUNNER_TEMP}/sonar-scanner-cli-${{ inputs.scannerVersion }}-${{ runner.os }}-${{ runner.arch }}/jre

run-sonar-scanner.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ if [[ -n "${SONAR_ROOT_CERT}" ]]; then
2525
echo "Adding SSL certificate to the Scanner truststore"
2626
rm -f $RUNNER_TEMP/tmpcert.pem
2727
echo "${SONAR_ROOT_CERT}" > $RUNNER_TEMP/tmpcert.pem
28-
# Use keytool for now, as SonarQube 11.6 won't support openssl generated keystores
28+
# Use keytool for now, as SonarQube 10.6 and below doesn't support openssl generated keystores
2929
# keytool require a password > 6 characters, so we wan't use the default password 'sonar'
3030
store_pass=changeit
3131
mkdir -p ~/.sonar/ssl
32-
keytool -storetype PKCS12 -keystore ~/.sonar/ssl/truststore.p12 -storepass $store_pass -noprompt -trustcacerts -importcert -alias sonar -file $RUNNER_TEMP/tmpcert.pem
32+
SONAR_SCANNER_JRE/bin/java sun.security.tools.keytool.Main -storetype PKCS12 -keystore ~/.sonar/ssl/truststore.p12 -storepass $store_pass -noprompt -trustcacerts -importcert -alias sonar -file $RUNNER_TEMP/tmpcert.pem
3333
scanner_args+=("-Dsonar.scanner.truststorePassword=$store_pass")
3434
fi
3535

0 commit comments

Comments
 (0)