From f2ae271d54ed468b7bdfd87b7d2ada1d032d2b07 Mon Sep 17 00:00:00 2001 From: didierC Date: Fri, 12 Jan 2024 08:57:19 +0100 Subject: [PATCH] #44 : SonarQube CNES 3.1.0 doesn't contain CNES quality profile and quality gate --- scripts/functions.bash | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/functions.bash b/scripts/functions.bash index d1c5d36..cca7b35 100755 --- a/scripts/functions.bash +++ b/scripts/functions.bash @@ -58,11 +58,21 @@ log() wait_sonarqube_up() { sonar_status="DOWN" + http_code=0 log $INFO "initiating connection with SonarQube." sleep 15 + while [ "$http_code" -ne 200 ] + do + sleep 5 + http_code=$(curl -i -su "admin:$SONARQUBE_ADMIN_PASSWORD" "${SONARQUBE_URL}" \ + | sed -n -r -e 's/^HTTP\/.+ ([0-9]+)/\1/p') + http_code=${http_code:0:3} # remove \n + log $INFO "SonarQube HTTP code is ${http_code}, expecting it to be 200." + done + log $INFO "SonarQube HTTP code is ${http_code}" while [ "${sonar_status}" != "UP" ] do - sleep 20 + sleep 5 sonar_status=$(curl -s -X GET "${SONARQUBE_URL}/api/system/status" | jq -r '.status') log $INFO "SonarQube is ${sonar_status}, expecting it to be UP." done