update retry strat
This commit is contained in:
parent
a9404fdc57
commit
360606bde4
1 changed files with 18 additions and 6 deletions
24
.github/workflows/update.yml
vendored
24
.github/workflows/update.yml
vendored
|
|
@ -96,7 +96,7 @@ jobs:
|
||||||
-H "Cookie: hydra_session=$SESSION_COOKIE" \
|
-H "Cookie: hydra_session=$SESSION_COOKIE" \
|
||||||
-d '{
|
-d '{
|
||||||
"enabled": 1,
|
"enabled": 1,
|
||||||
"visible": true,
|
"visible": false,
|
||||||
"keepnr": 3,
|
"keepnr": 3,
|
||||||
"schedulingshares": 100,
|
"schedulingshares": 100,
|
||||||
"checkinterval": 60,
|
"checkinterval": 60,
|
||||||
|
|
@ -125,21 +125,33 @@ 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"
|
||||||
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')
|
status=$(echo "$response" | jq -r '.[] | select(.name == "${{ env.HYDRA_JOBSET }}") | .nrfailed')
|
||||||
if [ "$status" = "0" ]; then
|
if [ "$status" = "0" ]; then
|
||||||
echo "BUILD_SUCCESS=true" >> $GITHUB_OUTPUT
|
build_success="true"
|
||||||
exit 0
|
break
|
||||||
elif [ "$status" != "null" ] && [ "$status" != "0" ]; then
|
elif [ "$status" != "null" ] && [ "$status" != "0" ]; then
|
||||||
echo "BUILD_SUCCESS=false" >> $GITHUB_OUTPUT
|
build_success="false"
|
||||||
exit 0
|
break
|
||||||
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
|
||||||
echo "BUILD_SUCCESS=false" >> $GITHUB_OUTPUT # Timeout, consider as failure
|
if [ "$build_success" = "unknown" ]; then
|
||||||
|
echo "Timeout reached. Considering build as failed."
|
||||||
|
build_success="false"
|
||||||
|
fi
|
||||||
|
echo "BUILD_SUCCESS=$build_success" >> $GITHUB_OUTPUT
|
||||||
|
if [ "$build_success" = "true" ]; then
|
||||||
|
echo "Build succeeded!"
|
||||||
|
else
|
||||||
|
echo "Build failed or timed out."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Merge PR if build succeeds
|
- name: Merge PR if build succeeds
|
||||||
if: steps.update-flake.outputs.CHANGED == 'true' && steps.wait-for-build.outputs.BUILD_SUCCESS == 'true'
|
if: steps.update-flake.outputs.CHANGED == 'true' && steps.wait-for-build.outputs.BUILD_SUCCESS == 'true'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue