|
56 | 56 |
|
57 | 57 | if [ -n "$CI_ID" ]; then
|
58 | 58 | CI=true
|
59 |
| - echo "Running in CI mode ($CI_ID)..." |
| 59 | + echo "Running in CI mode ($CI_ID) ..." |
60 | 60 |
|
61 | 61 | # Make sure we have the requirements to run kash functions
|
62 | 62 | set +e
|
63 |
| - command -v curl >/dev/null 2>&1 && command -v git >/dev/null 2>&1 && command -v sha256sum >/dev/null 2>&1 |
| 63 | + command -v curl >/dev/null 2>&1 && command -v git >/dev/null 2>&1 && command -v sha256sum >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1 |
64 | 64 | RC=$?
|
65 | 65 | set -e
|
66 | 66 |
|
67 | 67 | if [ "$RC" -ne 0 ]; then
|
68 | 68 | case "$OS_ID" in
|
69 | 69 | debian | ubuntu)
|
70 | 70 | if [ "$(id -u)" -eq 0 ]; then
|
71 |
| - apt-get update && apt-get --no-install-recommends --yes install sudo curl ca-certificates coreutils git |
| 71 | + apt-get update && apt-get --no-install-recommends --yes install sudo curl ca-certificates coreutils git unzip |
72 | 72 | else
|
73 |
| - sudo apt-get update && sudo apt-get --no-install-recommends --yes install curl ca-certificates coreutils git |
| 73 | + sudo apt-get update && sudo apt-get --no-install-recommends --yes install curl ca-certificates coreutils git unzip |
74 | 74 | fi
|
75 | 75 | ;;
|
76 | 76 | alpine)
|
77 |
| - apk update && apk add curl ca-certificates coreutils git |
| 77 | + apk update && apk add curl ca-certificates coreutils git unzip |
78 | 78 | ;;
|
79 | 79 | *)
|
80 | 80 | ;;
|
@@ -105,6 +105,12 @@ if [ -d "$HOME/.nvm" ]; then
|
105 | 105 | . "$HOME/.nvm/nvm.sh"
|
106 | 106 | fi
|
107 | 107 |
|
| 108 | +# If sonar-scanner-cli is present, add it to PATH |
| 109 | +# See install_sonar_scanner_cli |
| 110 | +if [ -d "$HOME/.local/sonar-scanner" ]; then |
| 111 | + export PATH=$PATH:$HOME/.local/sonar-scanner/bin |
| 112 | +fi |
| 113 | + |
108 | 114 | # Define a TMP_DIR to operate with temp files
|
109 | 115 | if [ -n "${RUNNER_TEMP:-}" ]; then # RUNNER_TEMP is Github Action specific
|
110 | 116 | TMP_DIR="$RUNNER_TEMP"
|
@@ -143,6 +149,9 @@ NODE22_VERSION=22.3.0
|
143 | 149 | MONGODB7_VERSION=7.0.15
|
144 | 150 | MONGODB8_VERSION=8.0.3
|
145 | 151 |
|
| 152 | +# https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ |
| 153 | +SONAR_SCANNER_CLI_VERSION=6.2.1.4610 |
| 154 | + |
146 | 155 | # Install yq in ~/.local/bin
|
147 | 156 | # Arg1: a writable folder where to write downloaded files
|
148 | 157 | install_yq() {
|
@@ -366,6 +375,22 @@ install_mongo8() {
|
366 | 375 | cd ~-
|
367 | 376 | }
|
368 | 377 |
|
| 378 | +# Install sonar-scanner in ~/.local/sonar-scanner-cli |
| 379 | +# Arg1: a writable folder where to write downloaded files |
| 380 | +install_sonar_scanner_cli() { |
| 381 | + local DL_ROOT=$1 |
| 382 | + local DL_PATH="$DL_ROOT/sonarscannercli" |
| 383 | + if [ ! -d "$DL_PATH" ]; then |
| 384 | + mkdir -p "$DL_PATH" && cd "$DL_PATH" |
| 385 | + curl -OLsS https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_CLI_VERSION}-linux-x64.zip |
| 386 | + unzip sonar-scanner-cli-${SONAR_SCANNER_CLI_VERSION}-linux-x64.zip |
| 387 | + cd ~- |
| 388 | + fi |
| 389 | + cd "$DL_PATH" |
| 390 | + mv sonar-scanner-${SONAR_SCANNER_CLI_VERSION}-linux-x64 ~/.local/sonar-scanner |
| 391 | + cd ~- |
| 392 | +} |
| 393 | + |
369 | 394 | # Install kubectl in ~/.local/bin
|
370 | 395 | # Expected args:
|
371 | 396 | # 1. a writable folder where to write downloaded files
|
|
0 commit comments