Skip to content

Commit 9f342c5

Browse files
authored
fix: fix and restore issues with release workflows (#2035)
* fix: we needed to restore publishing on merge or wf dispatch to us-east-1 * fix: bump to test release * fix: give some space for vector download * fix: Fix publish-prod condition to only match release/* branches and add missing -r flag to yq in publish-staging job * fix: stage2 doe snot have the var ami_regions * fix: we will not add extra data to ami testing suffix at this time * fix: need concurrency block that was lost * fix: Removed input parameter version extraction logic and always read all postgres versions from ansible/vars.yml to ensure all versions (15, 17, orioledb-17) are published. * chore: bump to test release again * chore: bump to release
1 parent 746e2b2 commit 9f342c5

6 files changed

Lines changed: 31 additions & 50 deletions

File tree

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,7 @@ jobs:
7272
- name: Generate common-nix.vars.pkr.hcl
7373
run: |
7474
PG_VERSION="$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)"
75-
BRANCH_NAME="$(echo "${{ github.ref }}" | sed 's|refs/heads/||')"
76-
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "$BRANCH_NAME" != "develop" && "$BRANCH_NAME" != release/* ]]; then
77-
SUFFIX="${BRANCH_NAME//[^a-zA-Z0-9._-]/-}-${{ github.run_id }}"
78-
PG_VERSION="${PG_VERSION}-${SUFFIX}"
79-
echo "Added branch suffix to version: $SUFFIX"
80-
fi
8175
echo "postgres-version = \"$PG_VERSION\"" > common-nix.vars.pkr.hcl
82-
# Ensure there's a newline at the end of the file
83-
echo "" >> common-nix.vars.pkr.hcl
8476
8577
- name: Build AMI stage 1
8678
env:
@@ -89,13 +81,13 @@ jobs:
8981
GIT_SHA=${{github.sha}}
9082
nix run github:supabase/postgres/${GIT_SHA}#packer -- init amazon-arm64-nix.pkr.hcl
9183
# why is postgresql_major defined here instead of where the _three_ other postgresql_* variables are defined?
92-
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
84+
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}" -var "region=us-east-1" -var 'ami_regions=["us-east-1"]' amazon-arm64-nix.pkr.hcl
9385
9486
- name: Find stage 1 AMI
9587
run: |
9688
GIT_SHA=${{github.sha}}
9789
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 ' "')
90+
REGION="us-east-1"
9991
10092
echo "Looking for stage 1 AMI with postgresVersion=${PG_VERSION}-stage1 and sourceSha=${GIT_SHA} in region ${REGION}"
10193
@@ -124,7 +116,7 @@ jobs:
124116
GIT_SHA=${{github.sha}}
125117
nix run github:supabase/postgres/${GIT_SHA}#packer -- init stage2-nix-psql.pkr.hcl
126118
POSTGRES_MAJOR_VERSION=${{ env.POSTGRES_MAJOR_VERSION }}
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
119+
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" -var "region=us-east-1" stage2-nix-psql.pkr.hcl
128120
129121
- name: Grab release version
130122
id: process_release_version

.github/workflows/nix-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ permissions:
1414
contents: write
1515
packages: write
1616

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20+
1721
jobs:
1822
nix-eval:
1923
uses: ./.github/workflows/nix-eval.yml

.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ jobs:
2424
- name: Set PostgreSQL versions
2525
id: set-versions
2626
run: |
27-
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
28-
MAJOR_VERSION=$(echo "${{ inputs.postgresVersion }}" | cut -d'.' -f1)
29-
VERSIONS="[\"$MAJOR_VERSION\"]"
30-
else
31-
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
32-
fi
27+
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
3328
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
3429
3530
publish-staging:
@@ -48,11 +43,7 @@ jobs:
4843
- name: Grab release version
4944
id: process_release_version
5045
run: |
51-
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
52-
VERSION="${{ inputs.postgresVersion }}"
53-
else
54-
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
55-
fi
46+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
5647
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
5748
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"
5849
@@ -87,7 +78,7 @@ jobs:
8778

8879
publish-prod:
8980
runs-on: large-linux-x86
90-
if: github.ref_name == 'develop' || contains( github.ref, 'release' )
81+
if: github.ref_name == 'develop' || startsWith(github.ref_name, 'release/')
9182
needs: prepare
9283
strategy:
9384
matrix:
@@ -100,11 +91,7 @@ jobs:
10091
- name: Grab release version
10192
id: process_release_version
10293
run: |
103-
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
104-
VERSION="${{ inputs.postgresVersion }}"
105-
else
106-
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
107-
fi
94+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
10895
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
10996
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"
11097

.github/workflows/publish-nix-pgupgrade-scripts.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ jobs:
2929
- name: Set PostgreSQL versions
3030
id: set-versions
3131
run: |
32-
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
33-
MAJOR_VERSION=$(echo "${{ inputs.postgresVersion }}" | cut -d'.' -f1)
34-
VERSIONS="[\"$MAJOR_VERSION\"]"
35-
else
36-
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
37-
fi
32+
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
3833
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
3934
4035
publish-staging:
@@ -53,11 +48,7 @@ jobs:
5348
- name: Grab release version
5449
id: process_release_version
5550
run: |
56-
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
57-
VERSION="${{ inputs.postgresVersion }}"
58-
else
59-
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
60-
fi
51+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
6152
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
6253
6354
- name: Create a tarball containing pg_upgrade scripts
@@ -88,7 +79,7 @@ jobs:
8879
publish-prod:
8980
needs: prepare
9081
runs-on: large-linux-x86
91-
if: github.ref_name == 'develop' || contains( github.ref, 'release' )
82+
if: github.ref_name == 'develop' || startsWith(github.ref_name, 'release/')
9283

9384
strategy:
9485
matrix:
@@ -104,11 +95,7 @@ jobs:
10495
- name: Grab release version
10596
id: process_release_version
10697
run: |
107-
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
108-
VERSION="${{ inputs.postgresVersion }}"
109-
else
110-
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
111-
fi
98+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
11299
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
113100
114101
- name: Create a tarball containing pg_upgrade scripts

ansible/tasks/setup-supabase-internal.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,20 @@
3333
ansible.builtin.command:
3434
cmd: aws configure set default.s3.use_dualstack_endpoint true
3535

36+
- name: download Vector package
37+
ansible.builtin.get_url:
38+
url: "{{ vector_x86_deb if platform == 'amd64' else vector_arm_deb }}"
39+
dest: /tmp/vector.deb
40+
timeout: 120
41+
become: true
42+
retries: 3
43+
delay: 10
44+
register: vector_download
45+
until: vector_download is success
46+
3647
- name: install Vector for logging
3748
apt:
38-
deb: "{{ vector_x86_deb if platform == 'amd64' else vector_arm_deb }}"
49+
deb: /tmp/vector.deb
3950
become: true
4051

4152
- name: add Vector to postgres group

ansible/vars.yml

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

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.6.0.037-orioledb"
14-
postgres17: "17.6.1.080"
15-
postgres15: "15.14.1.080"
13+
postgresorioledb-17: "17.6.0.038-orioledb"
14+
postgres17: "17.6.1.081"
15+
postgres15: "15.14.1.081"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.25.1
1919
pgbouncer_release_checksum: sha256:6e566ae92fe3ef7f6a1b9e26d6049f7d7ca39c40e29e7b38f6d5500ae15d8465
2020

21-
# The checksum can be found under "Assets", in the GitHub release page for each version.
21+
# The checksum can be found under "Assets", in the GitHub release page for each version.
2222
# The binaries used are: ubuntu-aarch64 and linux-static.
2323
# https://github.com/PostgREST/postgrest/releases
2424
postgrest_release: 14.1

0 commit comments

Comments
 (0)