scripts: pull_github_pr.sh: Fix auth problem detection

Before the patch, the script printed:

parse error: Invalid numeric literal at line 2, column 0

Closes scylladb/scylladb#26818
This commit is contained in:
Tomasz Grabiec
2025-10-31 10:03:00 +01:00
committed by Pavel Emelyanov
parent e7dbccd59e
commit 284c73d466

View File

@@ -133,10 +133,11 @@ check_jenkins_job_status() {
lastCompletedJobName="$jenkins_url/job/$jenkins_job/lastCompletedBuild"
getBuildResult=$(curl -s --user $JENKINS_USERNAME:$JENKINS_API_TOKEN $lastCompletedJobName/api/json?tree=result)
if [[ "$getBuildResult" == "*Unauthorized*" ]]; then
echo -e "${ORANGE}WARNING:${NC} Failed to authenticate with Jenkins. please check your JENKINS_USERNAME and JENKINS_API_TOKEN setting"
if [[ $getBuildResult =~ (Access Denied|401 Unauthorized) ]]; then
echo -e "${ORANGE}WARNING:${NC} Access Denied to $lastCompletedJobName. \nPlease check your JENKINS_USERNAME and JENKINS_API_TOKEN setting"
exit 1
fi
lastCompleted=$(echo "$getBuildResult" | jq -r '.result')
if [[ "$lastCompleted" == "SUCCESS" ]]; then