sonarqube-scan-action/scripts/download.sh
Claire Villard f00de44f57
Some checks failed
QA Deprecated C and C++ action / Action outputs (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-1 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-2 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-3 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-4 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-5 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-6 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-7 (push) Has been cancelled
QA Deprecated C and C++ action / Action outputs-8 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-1 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-2 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-3 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-4 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-5 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-6 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-7 (push) Has been cancelled
QA Install Build Wrapper action / Action outputs-8 (push) Has been cancelled
QA Main action / No inputs (push) Has been cancelled
QA Main action / No inputs -1 (push) Has been cancelled
QA Main action / 'args' input (push) Has been cancelled
QA Main action / 'args' input -1 (push) Has been cancelled
QA Main action / 'args' input -2 (push) Has been cancelled
QA Main action / 'args' input with command injection will fail (push) Has been cancelled
QA Main action / 'args' input with command injection will fail -1 (push) Has been cancelled
QA Main action / 'args' input with command injection will fail -2 (push) Has been cancelled
QA Main action / 'args' input with command injection will fail -3 (push) Has been cancelled
QA Main action / 'args' input with command injection will fail -4 (push) Has been cancelled
QA Main action / 'args' input with command injection will fail -5 (push) Has been cancelled
QA Main action / 'args' input with backticks injection does not execute command (push) Has been cancelled
QA Main action / 'args' input with backticks injection does not execute command -1 (push) Has been cancelled
QA Main action / 'args' input with backticks injection does not execute command -2 (push) Has been cancelled
QA Main action / 'args' input with dollar command injection does not execute command (push) Has been cancelled
QA Main action / 'args' input with dollar command injection does not execute command -1 (push) Has been cancelled
QA Main action / 'args' input with dollar command injection does not execute command -2 (push) Has been cancelled
QA Main action / 'args' input with other command injection variants does not execute command (push) Has been cancelled
QA Main action / 'args' input with other command injection variants does not execute command -1 (push) Has been cancelled
QA Main action / 'args' input with other command injection variants does not execute command -2 (push) Has been cancelled
QA Main action / 'projectBaseDir' input (push) Has been cancelled
QA Main action / 'projectBaseDir' input -1 (push) Has been cancelled
QA Main action / 'projectBaseDir' input -2 (push) Has been cancelled
QA Main action / 'scannerVersion' input (push) Has been cancelled
QA Main action / 'scannerBinariesUrl' input with invalid URL (push) Has been cancelled
QA Main action / 'scannerBinariesUrl' is escaped with wget so special chars are not injected in the download command (push) Has been cancelled
QA Main action / 'scannerBinariesUrl' is escaped with curl so special chars are not injected in the download command (push) Has been cancelled
QA Main action / Don't fail on Gradle project (push) Has been cancelled
QA Main action / Don't fail on Kotlin Gradle project (push) Has been cancelled
QA Main action / Don't fail on Maven project (push) Has been cancelled
QA Main action / runAnalysisTest (push) Has been cancelled
QA Main action / 'RUNNER_DEBUG' is used (push) Has been cancelled
QA Main action / 'RUNNER_DEBUG' is used -1 (push) Has been cancelled
QA Main action / 'RUNNER_DEBUG' is used -2 (push) Has been cancelled
QA Main action / runAnalysisWithCacheTest (push) Has been cancelled
QA Main action / 'SONARCLOUD_URL' is used (push) Has been cancelled
QA Main action / 'SONARCLOUD_URL' is used -1 (push) Has been cancelled
QA Main action / 'SONARCLOUD_URL' is used -2 (push) Has been cancelled
QA Main action / curl performs redirect when scannerBinariesUrl returns 3xx (push) Has been cancelled
QA Main action / 'SONAR_ROOT_CERT' is converted to truststore (push) Has been cancelled
QA Main action / 'SONAR_ROOT_CERT' is converted to truststore -1 (push) Has been cancelled
QA Main action / 'SONAR_ROOT_CERT' is converted to truststore -2 (push) Has been cancelled
QA Main action / Analysis takes into account 'SONAR_ROOT_CERT' (push) Has been cancelled
QA Main action / truststore.p12 is updated when present (push) Has been cancelled
QA Main action / 'scannerVersion' input validation (push) Has been cancelled
QA Scripts / create_install_path.sh (push) Has been cancelled
QA Scripts / configure_paths.sh (push) Has been cancelled
QA Scripts / download.sh (push) Has been cancelled
QA Scripts / fetch_latest_version.sh (push) Has been cancelled
Unit tests / test (push) Has been cancelled
SC-45750 Migrate to dateless license headers (#229)
2026-04-10 13:57:27 +02:00

76 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
# SonarQube Scan Action
# Copyright (C) SonarSource Sàrl
# mailto:contact AT sonarsource DOT com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
source "$(dirname -- "$0")/utils.sh"
VERIFY_CORRECTNESS=false
help() {
cat <<EOF
Usage: ./download [-v]
-h Display help
-v Verify correctness of a download with SHA256 checksum; Optional
EOF
}
parse_arguments() {
while getopts "hv" arg; do
case $arg in
v)
VERIFY_CORRECTNESS=true
echo "Verify correctness is set to true"
;;
?)
help
exit 0
;;
esac
done
}
verify_download_correctness() {
echo "${EXPECTED_SHA} ${TMP_ZIP_PATH}" | sha256sum -c -
check_status "Checking sha256 failed"
}
download() {
echo "Downloading '${DOWNLOAD_URL}'"
mkdir -p "${INSTALL_PATH}"
check_status "Failed to create ${INSTALL_PATH}"
curl -sSLo "${TMP_ZIP_PATH}" "${DOWNLOAD_URL}"
check_status "Failed to download '${DOWNLOAD_URL}'"
}
decompress() {
echo "Decompressing"
unzip -o -d "${INSTALL_PATH}" "${TMP_ZIP_PATH}"
check_status "Failed to unzip the archive into '${INSTALL_PATH}'"
}
####################################################################################
echo "::group::Download ${DOWNLOAD_URL}"
parse_arguments $@
download
if [ "$VERIFY_CORRECTNESS" = true ]; then
verify_download_correctness
fi
decompress
echo "::endgroup::"