Loading templates/gitlab-ci-sonar.yml +13 −4 Original line number Diff line number Diff line Loading @@ -157,6 +157,15 @@ stages: fi } function as_content() { file_or_content=$1 if [[ -f "${file_or_content}" ]]; then cat "${file_or_content}" else echo "${file_or_content}" fi } function install_ca_certs() { certs=$1 if [[ -z "$certs" ]] Loading @@ -167,12 +176,12 @@ stages: mkdir -p /tmp/certs # import in system if echo "$certs" >> /tmp/certs/ca-certificates.crt if as_content "$certs" >> /tmp/certs/ca-certificates.crt then log_info "CA certificates imported in \\e[33;1m/tmp/certs/ca-certificates.crt\\e[0m" export CURL_CA_BUNDLE=/tmp/certs/ca-certificates.crt fi if echo "$certs" >> /tmp/certs/cert.pem if as_content "$certs" >> /tmp/certs/cert.pem then log_info "CA certificates imported in \\e[33;1m/tmp/certs/cert.pem\\e[0m" export CURL_CA_BUNDLE=/tmp/certs/cert.pem Loading @@ -192,12 +201,12 @@ stages: # set writable keystore as keystore keystore="/tmp/writable_keystore" storepass=${JAVA_KEYSTORE_PASSWORD:-changeit} nb_certs=$(echo "$certs" | grep -c 'END CERTIFICATE') nb_certs=$(as_content "$certs" | grep -c 'END CERTIFICATE') log_info "importing $nb_certs certificates in Java keystore \\e[33;1m$keystore\\e[0m..." for idx in $(seq 0 $((nb_certs - 1))) do # TODO: use keytool option -trustcacerts ? if echo "$certs" | awk "n==$idx { print }; /END CERTIFICATE/ { n++ }" | keytool -noprompt -import -alias "imported CA Cert $idx" -keystore "$keystore" -storepass "$storepass" if as_content "$certs" | awk "n==$idx { print }; /END CERTIFICATE/ { n++ }" | keytool -noprompt -import -alias "imported CA Cert $idx" -keystore "$keystore" -storepass "$storepass" then log_info "... CA certificate [$idx] successfully imported" else Loading Loading
templates/gitlab-ci-sonar.yml +13 −4 Original line number Diff line number Diff line Loading @@ -157,6 +157,15 @@ stages: fi } function as_content() { file_or_content=$1 if [[ -f "${file_or_content}" ]]; then cat "${file_or_content}" else echo "${file_or_content}" fi } function install_ca_certs() { certs=$1 if [[ -z "$certs" ]] Loading @@ -167,12 +176,12 @@ stages: mkdir -p /tmp/certs # import in system if echo "$certs" >> /tmp/certs/ca-certificates.crt if as_content "$certs" >> /tmp/certs/ca-certificates.crt then log_info "CA certificates imported in \\e[33;1m/tmp/certs/ca-certificates.crt\\e[0m" export CURL_CA_BUNDLE=/tmp/certs/ca-certificates.crt fi if echo "$certs" >> /tmp/certs/cert.pem if as_content "$certs" >> /tmp/certs/cert.pem then log_info "CA certificates imported in \\e[33;1m/tmp/certs/cert.pem\\e[0m" export CURL_CA_BUNDLE=/tmp/certs/cert.pem Loading @@ -192,12 +201,12 @@ stages: # set writable keystore as keystore keystore="/tmp/writable_keystore" storepass=${JAVA_KEYSTORE_PASSWORD:-changeit} nb_certs=$(echo "$certs" | grep -c 'END CERTIFICATE') nb_certs=$(as_content "$certs" | grep -c 'END CERTIFICATE') log_info "importing $nb_certs certificates in Java keystore \\e[33;1m$keystore\\e[0m..." for idx in $(seq 0 $((nb_certs - 1))) do # TODO: use keytool option -trustcacerts ? if echo "$certs" | awk "n==$idx { print }; /END CERTIFICATE/ { n++ }" | keytool -noprompt -import -alias "imported CA Cert $idx" -keystore "$keystore" -storepass "$storepass" if as_content "$certs" | awk "n==$idx { print }; /END CERTIFICATE/ { n++ }" | keytool -noprompt -import -alias "imported CA Cert $idx" -keystore "$keystore" -storepass "$storepass" then log_info "... CA certificate [$idx] successfully imported" else Loading