mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2025-12-17 03:18:28 +00:00
SQSCANGHA-44 Fix import custom certificates
This commit is contained in:
parent
2af7c4bea3
commit
eb87f55c65
3 changed files with 18 additions and 10 deletions
12
.github/workflows/qa.yml
vendored
12
.github/workflows/qa.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
||||||
- name: Run action with args
|
- name: Run action with args
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: -Dsonar.someArg=aValue -Dsonar.scanner.dumpToFile=./output.properties
|
args: -Dsonar.someArg=aValue -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
- name: Assert
|
- name: Assert
|
||||||
|
|
@ -37,7 +37,7 @@ jobs:
|
||||||
- name: Run action with projectBaseDir
|
- name: Run action with projectBaseDir
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: -Dsonar.scanner.dumpToFile=./output.properties
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
projectBaseDir: ./baseDir
|
projectBaseDir: ./baseDir
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
|
|
@ -60,7 +60,7 @@ jobs:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
with:
|
with:
|
||||||
projectBaseDir: ./test/gradle-project
|
projectBaseDir: ./test/gradle-project
|
||||||
args: -Dsonar.scanner.dumpToFile=./output.properties
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
- name: Assert
|
- name: Assert
|
||||||
run: |
|
run: |
|
||||||
./test/assertFileExists ./output.properties
|
./test/assertFileExists ./output.properties
|
||||||
|
|
@ -80,7 +80,7 @@ jobs:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
with:
|
with:
|
||||||
projectBaseDir: ./test/gradle-project
|
projectBaseDir: ./test/gradle-project
|
||||||
args: -Dsonar.scanner.dumpToFile=./output.properties
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
- name: Assert
|
- name: Assert
|
||||||
run: |
|
run: |
|
||||||
./test/assertFileExists ./output.properties
|
./test/assertFileExists ./output.properties
|
||||||
|
|
@ -100,7 +100,7 @@ jobs:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
with:
|
with:
|
||||||
projectBaseDir: ./test/maven-project
|
projectBaseDir: ./test/maven-project
|
||||||
args: -Dsonar.scanner.dumpToFile=./output.properties
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
- name: Assert
|
- name: Assert
|
||||||
run: |
|
run: |
|
||||||
./test/assertFileExists ./output.properties
|
./test/assertFileExists ./output.properties
|
||||||
|
|
@ -146,7 +146,7 @@ jobs:
|
||||||
- name: Run action with debug mode
|
- name: Run action with debug mode
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: -Dsonar.scanner.dumpToFile=./output.properties
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
env:
|
env:
|
||||||
RUNNER_DEBUG: 1
|
RUNNER_DEBUG: 1
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM sonarsource/sonar-scanner-cli:10.0
|
FROM sonarsource/sonar-scanner-cli:11.0
|
||||||
|
|
||||||
LABEL version="2.1.0" \
|
LABEL version="2.1.0" \
|
||||||
repository="https://github.com/sonarsource/sonarqube-scan-action" \
|
repository="https://github.com/sonarsource/sonarqube-scan-action" \
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,19 @@ if [[ -z "${SONAR_TOKEN}" ]]; then
|
||||||
echo "============================ WARNING ============================"
|
echo "============================ WARNING ============================"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
trust_store_pass_param=''
|
||||||
if [[ -n "${SONAR_ROOT_CERT}" ]]; then
|
if [[ -n "${SONAR_ROOT_CERT}" ]]; then
|
||||||
echo "Adding custom root certificate to java certificate store"
|
echo "Adding custom certificate"
|
||||||
|
|
||||||
|
trust_store_pass="changeit"
|
||||||
|
trust_store_pass_param="-Dsonar.scanner.truststorePassword=${trust_store_pass}"
|
||||||
|
|
||||||
rm -f /tmp/tmpcert.pem
|
rm -f /tmp/tmpcert.pem
|
||||||
echo "${SONAR_ROOT_CERT}" > /tmp/tmpcert.pem
|
echo "${SONAR_ROOT_CERT}" > /tmp/tmpcert.pem
|
||||||
keytool -keystore /etc/ssl/certs/java/cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias sonarqube -file /tmp/tmpcert.pem
|
|
||||||
|
rm -f /opt/sonar-scanner/.sonar/ssl/truststore.p12
|
||||||
|
mkdir -p /opt/sonar-scanner/.sonar/ssl
|
||||||
|
openssl pkcs12 -export -nokeys -in /tmp/tmpcert.pem -out /opt/sonar-scanner/.sonar/ssl/truststore.p12 --passout pass:${trust_store_pass}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${INPUT_PROJECTBASEDIR%/}/pom.xml" ]]; then
|
if [[ -f "${INPUT_PROJECTBASEDIR%/}/pom.xml" ]]; then
|
||||||
|
|
@ -32,5 +40,5 @@ fi
|
||||||
|
|
||||||
unset JAVA_HOME
|
unset JAVA_HOME
|
||||||
|
|
||||||
sonar-scanner $debug_flag -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}
|
sonar-scanner $debug_flag $trust_store_pass_param -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue