Skip to content

Commit 25d86be

Browse files
authored
fix: adaptive retry on aws (#1917)
* fix: adaptive retry on aws * fix: also Wait longer for instance state transitions
1 parent 4615b6c commit 25d86be

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.github/workflows/testinfra-ami-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,18 @@ jobs:
109109
echo "" >> common-nix.vars.pkr.hcl
110110
111111
- name: Build AMI stage 1
112+
env:
113+
AWS_MAX_ATTEMPTS: 10
114+
AWS_RETRY_MODE: adaptive
112115
run: |
113116
GIT_SHA=${{github.sha}}
114117
nix run github:supabase/postgres/${GIT_SHA}#packer -- init amazon-arm64-nix.pkr.hcl
115118
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=" -var "postgres-version=${{ steps.random.outputs.random_string }}" -var "region=ap-southeast-1" -var 'ami_regions=["ap-southeast-1"]' -var "force-deregister=true" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" amazon-arm64-nix.pkr.hcl
116119
117120
- name: Build AMI stage 2
121+
env:
122+
AWS_MAX_ATTEMPTS: 10
123+
AWS_RETRY_MODE: adaptive
118124
run: |
119125
GIT_SHA=${{github.sha}}
120126
nix run github:supabase/postgres/${GIT_SHA}#packer -- init stage2-nix-psql.pkr.hcl

amazon-arm64-nix.pkr.hcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ source "amazon-ebssurrogate" "source" {
115115
#secret_key = "${var.aws_secret_key}"
116116
force_deregister = var.force-deregister
117117

118+
# Increase timeout for instance stop operations to handle large instances
119+
aws_polling {
120+
delay_seconds = 15
121+
max_attempts = 120 # 120 * 15s = 30 minutes max wait
122+
}
123+
118124
# Use latest official ubuntu noble ami owned by Canonical.
119125
source_ami_filter {
120126
filters = {

stage2-nix-psql.pkr.hcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ source "amazon-ebs" "ubuntu" {
8181

8282
associate_public_ip_address = true
8383

84+
# Increase timeout for instance stop operations to handle large instances
85+
aws_polling {
86+
delay_seconds = 15
87+
max_attempts = 120 # 120 * 15s = 30 minutes max wait
88+
}
8489

8590
ena_support = true
8691

0 commit comments

Comments
 (0)