upd retry strat
This commit is contained in:
parent
569589be82
commit
99c0b7a018
1 changed files with 22 additions and 11 deletions
33
.github/workflows/update.yml
vendored
33
.github/workflows/update.yml
vendored
|
|
@ -125,28 +125,39 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
max_attempts=60 # 30 minutes (30 * 2 minutes)
|
max_attempts=60 # 30 minutes (30 * 2 minutes)
|
||||||
attempt=0
|
attempt=0
|
||||||
build_success="unknown"
|
build_status="unknown"
|
||||||
while [ $attempt -lt $max_attempts ]; do
|
while [ $attempt -lt $max_attempts ]; do
|
||||||
response=$(curl -s -H "Cookie: hydra_session=$SESSION_COOKIE" \
|
response=$(curl -s -H "Cookie: hydra_session=$SESSION_COOKIE" \
|
||||||
"${{ env.HYDRA_INSTANCE }}/api/jobsets?project=${{ env.HYDRA_PROJECT }}")
|
"${{ env.HYDRA_INSTANCE }}/api/jobsets?project=${{ env.HYDRA_PROJECT }}")
|
||||||
status=$(echo "$response" | jq -r '.[] | select(.name == "${{ env.HYDRA_JOBSET }}") | .nrfailed')
|
nrscheduled=$(echo "$response" | jq -r '.[] | select(.name == "${{ env.HYDRA_JOBSET }}") | .nrscheduled')
|
||||||
if [ "$status" = "0" ]; then
|
nrfailed=$(echo "$response" | jq -r '.[] | select(.name == "${{ env.HYDRA_JOBSET }}") | .nrfailed')
|
||||||
build_success="true"
|
nrtotal=$(echo "$response" | jq -r '.[] | select(.name == "${{ env.HYDRA_JOBSET }}") | .nrtotal')
|
||||||
|
|
||||||
|
echo "Attempt $((attempt+1))/$max_attempts: nrscheduled=$nrscheduled, nrfailed=$nrfailed, nrtotal=$nrtotal"
|
||||||
|
|
||||||
|
if [ "$nrtotal" = "0" ] || [ "$nrscheduled" = "0" -a "$nrfailed" = "0" ]; then
|
||||||
|
echo "Build not started yet. Waiting..."
|
||||||
|
elif [ "$nrfailed" != "0" ]; then
|
||||||
|
build_status="failed"
|
||||||
break
|
break
|
||||||
elif [ "$status" != "null" ] && [ "$status" != "0" ]; then
|
elif [ "$nrscheduled" = "0" ]; then
|
||||||
build_success="false"
|
build_status="succeeded"
|
||||||
break
|
break
|
||||||
|
else
|
||||||
|
echo "Build in progress. Waiting..."
|
||||||
fi
|
fi
|
||||||
echo "Attempt $((attempt+1))/$max_attempts: Build still in progress or not started. Waiting 2 minutes..."
|
|
||||||
sleep 120 # Wait for 2 minutes before checking again
|
sleep 120 # Wait for 2 minutes before checking again
|
||||||
((attempt++))
|
((attempt++))
|
||||||
done
|
done
|
||||||
if [ "$build_success" = "unknown" ]; then
|
|
||||||
|
if [ "$build_status" = "unknown" ]; then
|
||||||
echo "Timeout reached. Considering build as failed."
|
echo "Timeout reached. Considering build as failed."
|
||||||
build_success="false"
|
build_status="failed"
|
||||||
fi
|
fi
|
||||||
echo "BUILD_SUCCESS=$build_success" >> $GITHUB_OUTPUT
|
|
||||||
if [ "$build_success" = "true" ]; then
|
echo "BUILD_SUCCESS=$([ "$build_status" = "succeeded" ] && echo "true" || echo "false")" >> $GITHUB_OUTPUT
|
||||||
|
if [ "$build_status" = "succeeded" ]; then
|
||||||
echo "Build succeeded!"
|
echo "Build succeeded!"
|
||||||
else
|
else
|
||||||
echo "Build failed or timed out."
|
echo "Build failed or timed out."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue