mirror of
https://github.com/SonarSource/sonarqube-quality-gate-action.git
synced 2026-09-23 13:38:32 +00:00
SONAR-16063 Allow trusted redirects
This commit is contained in:
@@ -27,19 +27,19 @@ if [ -z "${serverUrl}" ] || [ -z "${ceTaskUrl}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
task="$(curl --silent --fail --show-error --user "${SONAR_TOKEN}": "${ceTaskUrl}")"
|
task="$(curl --location --location-trusted --max-redirs 10 --silent --fail --show-error --user "${SONAR_TOKEN}": "${ceTaskUrl}")"
|
||||||
status="$(jq -r '.task.status' <<< "$task")"
|
status="$(jq -r '.task.status' <<< "$task")"
|
||||||
|
|
||||||
until [[ ${status} != "PENDING" && ${status} != "IN_PROGRESS" ]]; do
|
until [[ ${status} != "PENDING" && ${status} != "IN_PROGRESS" ]]; do
|
||||||
printf '.'
|
printf '.'
|
||||||
sleep 5s
|
sleep 5s
|
||||||
task="$(curl --silent --fail --show-error --user "${SONAR_TOKEN}": "${ceTaskUrl}")"
|
task="$(curl --location --location-trusted --max-redirs 10 --silent --fail --show-error --user "${SONAR_TOKEN}": "${ceTaskUrl}")"
|
||||||
status="$(jq -r '.task.status' <<< "$task")"
|
status="$(jq -r '.task.status' <<< "$task")"
|
||||||
done
|
done
|
||||||
|
|
||||||
analysisId="$(jq -r '.task.analysisId' <<< "${task}")"
|
analysisId="$(jq -r '.task.analysisId' <<< "${task}")"
|
||||||
qualityGateUrl="${serverUrl}/api/qualitygates/project_status?analysisId=${analysisId}"
|
qualityGateUrl="${serverUrl}/api/qualitygates/project_status?analysisId=${analysisId}"
|
||||||
qualityGateStatus="$(curl --silent --fail --show-error --user "${SONAR_TOKEN}": "${qualityGateUrl}" | jq -r '.projectStatus.status')"
|
qualityGateStatus="$(curl --location --location-trusted --max-redirs 10 --silent --fail --show-error --user "${SONAR_TOKEN}": "${qualityGateUrl}" | jq -r '.projectStatus.status')"
|
||||||
|
|
||||||
if [[ ${qualityGateStatus} == "OK" ]]; then
|
if [[ ${qualityGateStatus} == "OK" ]]; then
|
||||||
echo '::set-output name=quality-gate-status::PASSED'
|
echo '::set-output name=quality-gate-status::PASSED'
|
||||||
|
|||||||
Reference in New Issue
Block a user