Skip to content

Commit 213a5d1

Browse files
committed
Use timeout-minutes / remove custom timeout
1 parent dc6df36 commit 213a5d1

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

.github/workflows/update-canary.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,32 @@ jobs:
1515
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
1616
aws-region: us-west-2
1717

18-
# Maven can take up to an hour after the release has succeeded to publish our artifacts
18+
1919
- name: Verify artifact is available on Maven
2020
shell: bash
21+
# Maven can take up to 2 hours after the release has succeeded to publish our artifacts
22+
# FIXME Track execution duration over time and see if this can be shortened
23+
timeout-minutes: 120
2124
run: |
2225
TAG="${{ github.event.release.tag_name }}"
2326
VERSION="${TAG#v}"
2427
MAVEN_URL="https://repo.maven.apache.org/maven2/aws/sdk/kotlin/s3/${VERSION}/"
2528
2629
echo "Checking for an artifact at $MAVEN_URL"
2730
28-
# Retry settings
29-
MAX_WAIT_MINUTES=60
30-
INTERVAL_SECONDS=30
31-
MAX_ATTEMPTS=$(( MAX_WAIT_MINUTES * 60 / INTERVAL_SECONDS ))
32-
ATTEMPT=1
33-
34-
while [[ $ATTEMPT -le $MAX_ATTEMPTS ]]; do
31+
while true; do
3532
STATUS=$(curl -i -s -o /dev/null -w "%{http_code}" "$MAVEN_URL")
3633
if [[ "$STATUS" == "200" ]]; then
3734
echo "Artifact is available at $MAVEN_URL"
3835
exit 0
3936
fi
4037
41-
sleep "$INTERVAL_SECONDS"
42-
((ATTEMPT++))
38+
sleep 30
4339
done
4440
45-
echo "Timed out after $MAX_WAIT_MINUTES minutes. Artifact not available at $MAVEN_URL"
46-
exit 1
47-
4841
- name: Update canary
4942
shell: bash
43+
timeout-minutes: 15
5044
run: |
5145
set -euo pipefail
5246
@@ -63,27 +57,17 @@ jobs:
6357
--output text)
6458
6559
echo "Waiting for step function to complete..."
66-
67-
MAX_WAIT_SECONDS=$((15 * 60))
68-
INTERVAL=10
69-
ELAPSED=0
70-
60+
7161
while true; do
7262
STATUS=$(aws stepfunctions describe-execution --execution-arn "$EXECUTION_ARN" --query 'status' --output text)
7363
7464
if [[ "$STATUS" == "SUCCEEDED" ]]; then
7565
echo "Step Function completed successfully"
76-
break
66+
exit 0
7767
elif [[ "$STATUS" == "FAILED" || "$STATUS" == "TIMED_OUT" || "$STATUS" == "ABORTED" ]]; then
7868
echo "Step Function failed with status: $STATUS"
7969
exit 1
8070
fi
81-
82-
if [[ "$ELAPSED" -ge "$MAX_WAIT_SECONDS" ]]; then
83-
echo "Timeout exceeded, cancelling..."
84-
exit 1
85-
fi
86-
87-
sleep "$INTERVAL"
88-
ELAPSED=$((ELAPSED + INTERVAL))
71+
72+
sleep 10
8973
done

0 commit comments

Comments
 (0)