Skip to content

Commit 28fe8c1

Browse files
authored
fix: look up and pass stage 1 name (#2032)
* fix: look up and pass stage 1 name * chore: bump to release
1 parent d411fcd commit 28fe8c1

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,40 @@ jobs:
9191
# why is postgresql_major defined here instead of where the _three_ other postgresql_* variables are defined?
9292
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=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" amazon-arm64-nix.pkr.hcl
9393
94+
- name: Find stage 1 AMI
95+
run: |
96+
GIT_SHA=${{github.sha}}
97+
PG_VERSION=$(sed -n 's/postgres-version = "\(.*\)"/\1/p' common-nix.vars.pkr.hcl)
98+
REGION=$(grep '^region=' development-arm.vars.pkr.hcl | cut -d'=' -f2 | tr -d ' "')
99+
100+
echo "Looking for stage 1 AMI with postgresVersion=${PG_VERSION}-stage1 and sourceSha=${GIT_SHA} in region ${REGION}"
101+
102+
STAGE1_AMI_ID=$(aws ec2 describe-images \
103+
--region "$REGION" \
104+
--owners self \
105+
--filters \
106+
"Name=tag:postgresVersion,Values=${PG_VERSION}-stage1" \
107+
"Name=tag:sourceSha,Values=${GIT_SHA}" \
108+
"Name=state,Values=available" \
109+
--query 'Images[0].ImageId' \
110+
--output text)
111+
112+
if [ -z "$STAGE1_AMI_ID" ] || [ "$STAGE1_AMI_ID" = "None" ]; then
113+
echo "ERROR: Failed to find stage 1 AMI"
114+
exit 1
115+
fi
116+
117+
echo "Found stage 1 AMI: $STAGE1_AMI_ID"
118+
echo "STAGE1_AMI_ID=$STAGE1_AMI_ID" >> "$GITHUB_ENV"
119+
94120
- name: Build AMI stage 2
95121
env:
96122
POSTGRES_MAJOR_VERSION: ${{ env.POSTGRES_MAJOR_VERSION }}
97123
run: |
98124
GIT_SHA=${{github.sha}}
99125
nix run github:supabase/postgres/${GIT_SHA}#packer -- init stage2-nix-psql.pkr.hcl
100126
POSTGRES_MAJOR_VERSION=${{ env.POSTGRES_MAJOR_VERSION }}
101-
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" stage2-nix-psql.pkr.hcl
127+
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var "source_ami=${STAGE1_AMI_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" stage2-nix-psql.pkr.hcl
102128
103129
- name: Grab release version
104130
id: process_release_version

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.6.0.035-orioledb"
14-
postgres17: "17.6.1.078"
15-
postgres15: "15.14.1.078"
13+
postgresorioledb-17: "17.6.0.036-orioledb"
14+
postgres17: "17.6.1.079"
15+
postgres15: "15.14.1.079"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.25.1

0 commit comments

Comments
 (0)