Skip to content

Commit 8960483

Browse files
authored
misc: add update-canary workflow (#1571)
1 parent 99d1898 commit 8960483

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# After every GitHub release, verify that the Maven artifacts are available, then kick off
2+
# a canary deployment with the latest version of the SDK.
3+
name: Update Canary
4+
on:
5+
release:
6+
types: [ published ]
7+
8+
jobs:
9+
update-canary:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Configure AWS Credentials
13+
uses: aws-actions/configure-aws-credentials@v4
14+
with:
15+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
16+
aws-region: us-west-2
17+
18+
19+
- name: Verify artifact is available on Maven
20+
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
24+
run: |
25+
TAG="${{ github.event.release.tag_name }}"
26+
VERSION="${TAG#v}"
27+
MAVEN_URL="https://repo.maven.apache.org/maven2/aws/sdk/kotlin/s3/${VERSION}/"
28+
29+
echo "Checking for an artifact at $MAVEN_URL"
30+
31+
while true; do
32+
STATUS=$(curl -i -s -o /dev/null -w "%{http_code}" "$MAVEN_URL")
33+
echo "Status: $STATUS"
34+
35+
if [[ "$STATUS" == "200" ]]; then
36+
echo "Artifact is available at $MAVEN_URL"
37+
exit 0
38+
fi
39+
40+
sleep 30
41+
done
42+
43+
- name: Update canary
44+
shell: bash
45+
timeout-minutes: 15
46+
run: |
47+
set -euo pipefail
48+
49+
TAG="${{ github.event.release.tag_name }}"
50+
EXECUTION_NAME="update-canary-${TAG}"
51+
STATE_MACHINE_ARN="arn:aws:states:us-west-2:${{ secrets.CI_USER }}:stateMachine:DeployLatestSdkVersion"
52+
53+
echo "Starting step function: $EXECUTION_NAME"
54+
EXECUTION_ARN=$(aws stepfunctions start-execution \
55+
--state-machine-arn "$STATE_MACHINE_ARN" \
56+
--name "$EXECUTION_NAME" \
57+
--input '{}' \
58+
--query 'executionArn' \
59+
--output text)
60+
61+
echo "Waiting for step function to complete..."
62+
63+
while true; do
64+
STATUS=$(aws stepfunctions describe-execution --execution-arn "$EXECUTION_ARN" --query 'status' --output text)
65+
echo "Status: $STATUS"
66+
67+
if [[ "$STATUS" == "SUCCEEDED" ]]; then
68+
echo "Step Function completed successfully"
69+
exit 0
70+
elif [[ "$STATUS" == "FAILED" || "$STATUS" == "TIMED_OUT" || "$STATUS" == "ABORTED" ]]; then
71+
echo "Step Function failed with status: $STATUS"
72+
exit 1
73+
fi
74+
75+
sleep 10
76+
done

0 commit comments

Comments
 (0)