Skip to content

Commit 6d67a57

Browse files
Merge branch 'develop' into TheOtherBrian1-patch-1
2 parents 73aedc1 + d61c5c4 commit 6d67a57

File tree

77 files changed

+4082
-847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4082
-847
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Run checks if triggered manually
5656
if: ${{ github.event_name == 'workflow_dispatch' }}
5757
run: |
58-
SUFFIX=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres${{ matrix.postgres_version }}"]' ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
58+
SUFFIX=$(sudo nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
5959
if [[ -z $SUFFIX ]] ; then
6060
echo "Version must include non-numeric characters if built manually."
6161
exit 1

.github/workflows/dockerhub-release-15-6.yml renamed to .github/workflows/dockerhub-release-15-8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
platforms: linux/${{ matrix.arch }}
6161
cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
6262
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
63-
file: "Dockerfile-156"
63+
file: "Dockerfile-158"
6464
- name: Slack Notification
6565
if: ${{ failure() }}
6666
uses: rtCamp/action-slack-notify@v2

.github/workflows/dockerhub-release-aio.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
push: true
7575
build-args: |
7676
postgres_version=${{ needs.settings.outputs.base_docker_version }}
77+
envoy_lds=lds.supabase.yaml
7778
${{ needs.settings.outputs.build_args }}
7879
target: production
7980
tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }}
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
name: Release all major versions on Dockerhub
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- release/*
8+
paths:
9+
- ".github/workflows/dockerhub-release-matrix.yml"
10+
workflow_dispatch:
11+
12+
jobs:
13+
prepare:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
17+
steps:
18+
- uses: DeterminateSystems/nix-installer-action@main
19+
- name: Checkout Repo
20+
uses: actions/checkout@v3
21+
- name: Generate build matrix
22+
id: set-matrix
23+
run: |
24+
nix run nixpkgs#nushell -- -c 'let versions = (open ansible/vars.yml | get postgres_major)
25+
let matrix = ($versions | each { |ver|
26+
let version = ($ver | str trim)
27+
let dockerfile = $"Dockerfile-($version)"
28+
if ($dockerfile | path exists) {
29+
{
30+
version: $version,
31+
dockerfile: $dockerfile
32+
}
33+
} else {
34+
null
35+
}
36+
} | compact)
37+
38+
let matrix_config = {
39+
include: $matrix
40+
}
41+
42+
$"matrix_config=($matrix_config | to json -r)" | save --append $env.GITHUB_OUTPUT'
43+
build:
44+
needs: prepare
45+
strategy:
46+
matrix: ${{ fromJson(needs.prepare.outputs.matrix_config) }}
47+
runs-on: ubuntu-latest
48+
outputs:
49+
build_args: ${{ steps.args.outputs.result }}
50+
steps:
51+
- uses: actions/checkout@v3
52+
- uses: DeterminateSystems/nix-installer-action@main
53+
- name: Set PostgreSQL version environment variable
54+
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
55+
56+
- id: args
57+
run: |
58+
nix run nixpkgs#nushell -- -c '
59+
open ansible/vars.yml
60+
| items { |key value| {name: $key, item: $value} }
61+
| where { |it| ($it.item | describe) == "string" }
62+
| each { |it| $"($it.name)=($it.item)" }
63+
| str join "\n"
64+
| save --append $env.GITHUB_OUTPUT
65+
'
66+
build_release_image:
67+
needs: [prepare, build]
68+
strategy:
69+
matrix:
70+
postgres: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
71+
arch: [amd64, arm64]
72+
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
73+
timeout-minutes: 180
74+
steps:
75+
- uses: actions/checkout@v3
76+
- uses: DeterminateSystems/nix-installer-action@main
77+
- run: docker context create builders
78+
- uses: docker/setup-buildx-action@v3
79+
with:
80+
endpoint: builders
81+
- uses: docker/login-action@v2
82+
with:
83+
username: ${{ secrets.DOCKER_USERNAME }}
84+
password: ${{ secrets.DOCKER_PASSWORD }}
85+
- name: Get image tag
86+
id: image
87+
run: |
88+
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
89+
pg_version=$(sudo nix run nixpkgs#nushell -- -c '
90+
let version = "${{ matrix.postgres.version }}"
91+
let release_key = if ($version | str contains "orioledb") {
92+
$"postgresorioledb-17"
93+
} else {
94+
$"postgres($version)"
95+
}
96+
open ansible/vars.yml | get postgres_release | get $release_key | str trim
97+
')
98+
echo "pg_version=supabase/postgres:$pg_version" >> $GITHUB_OUTPUT
99+
else
100+
pg_version=$(nix run nixpkgs#nushell -- -c '
101+
let version = "${{ matrix.postgres.version }}"
102+
let release_key = if ($version | str contains "orioledb") {
103+
$"postgresorioledb-17"
104+
} else {
105+
$"postgres($version)"
106+
}
107+
open ansible/vars.yml | get postgres_release | get $release_key | str trim
108+
')
109+
echo "pg_version=supabase/postgres:$pg_version" >> $GITHUB_OUTPUT
110+
fi
111+
- id: build
112+
uses: docker/build-push-action@v5
113+
with:
114+
push: true
115+
build-args: |
116+
${{ needs.build.outputs.build_args }}
117+
target: production
118+
tags: ${{ steps.image.outputs.pg_version }}_${{ matrix.arch }}
119+
platforms: linux/${{ matrix.arch }}
120+
cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
121+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
122+
file: ${{ matrix.postgres.dockerfile }}
123+
merge_manifest:
124+
needs: [prepare, build, build_release_image]
125+
strategy:
126+
matrix:
127+
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
128+
runs-on: ubuntu-latest
129+
steps:
130+
- uses: actions/checkout@v3
131+
- uses: DeterminateSystems/nix-installer-action@main
132+
- uses: docker/setup-buildx-action@v3
133+
- uses: docker/login-action@v2
134+
with:
135+
username: ${{ secrets.DOCKER_USERNAME }}
136+
password: ${{ secrets.DOCKER_PASSWORD }}
137+
- name: Get image tag
138+
id: get_version
139+
run: |
140+
nix run nixpkgs#nushell -- -c '
141+
let version = "${{ matrix.version }}"
142+
let release_key = if ($version | str contains "orioledb") {
143+
$"postgresorioledb-17"
144+
} else {
145+
$"postgres($version)"
146+
}
147+
let pg_version = (open ansible/vars.yml | get postgres_release | get $release_key | str trim)
148+
$"pg_version=supabase/postgres:($pg_version)" | save --append $env.GITHUB_OUTPUT
149+
'
150+
- name: Output version
151+
id: output_version
152+
run: |
153+
echo "result=${{ steps.get_version.outputs.pg_version }}" >> $GITHUB_OUTPUT
154+
- name: Collect versions
155+
id: collect_versions
156+
run: |
157+
echo "${{ steps.output_version.outputs.result }}" >> results.txt # Append results
158+
- name: Upload Results Artifact
159+
uses: actions/upload-artifact@v3
160+
with:
161+
name: merge_results-${{ matrix.version }}
162+
path: results.txt
163+
if-no-files-found: warn
164+
- name: Merge multi-arch manifests
165+
run: |
166+
docker buildx imagetools create -t ${{ steps.get_version.outputs.pg_version }} \
167+
${{ steps.get_version.outputs.pg_version }}_amd64 \
168+
${{ steps.get_version.outputs.pg_version }}_arm64
169+
combine_results:
170+
needs: [prepare, merge_manifest]
171+
runs-on: ubuntu-latest
172+
steps:
173+
- uses: actions/checkout@v3
174+
- uses: DeterminateSystems/nix-installer-action@main
175+
176+
- name: Debug Input from Prepare
177+
run: |
178+
echo "Raw matrix_config output:"
179+
echo "${{ needs.prepare.outputs.matrix_config }}"
180+
- name: Get Versions from Matrix Config
181+
id: get_versions
182+
run: |
183+
nix run nixpkgs#nushell -- -c '
184+
# Parse the matrix configuration directly
185+
let matrix_config = (${{ toJson(needs.prepare.outputs.matrix_config) }} | from json)
186+
187+
# Get versions directly from include array
188+
let versions = ($matrix_config.include | get version)
189+
190+
echo "Versions: $versions"
191+
192+
# Convert the versions to a comma-separated string
193+
let versions_str = ($versions | str join ",")
194+
$"versions=$versions_str" | save --append $env.GITHUB_ENV
195+
'
196+
- name: Download Results Artifacts
197+
uses: actions/download-artifact@v3
198+
with:
199+
pattern: merge_results-*
200+
- name: Combine Results
201+
id: combine
202+
run: |
203+
nix run nixpkgs#nushell -- -c '
204+
# Get all results files and process them in one go
205+
let files = (ls **/results.txt | get name)
206+
echo $"Found files: ($files)"
207+
208+
let matrix = {
209+
include: (
210+
$files
211+
| each { |file| open $file } # Open each file
212+
| each { |content| $content | lines } # Split into lines
213+
| flatten # Flatten the nested lists
214+
| where { |line| $line != "" } # Filter empty lines
215+
| each { |line|
216+
# Extract just the version part after the last colon
217+
let version = ($line | parse "supabase/postgres:{version}" | get version.0)
218+
{version: $version}
219+
}
220+
)
221+
}
222+
223+
let json_output = ($matrix | to json -r) # -r for raw output
224+
echo $"Debug output: ($json_output)"
225+
226+
$"matrix=($json_output)" | save --append $env.GITHUB_OUTPUT
227+
'
228+
- name: Debug Combined Results
229+
run: |
230+
echo "Combined Results: '${{ steps.combine.outputs.matrix }}'"
231+
outputs:
232+
matrix: ${{ steps.combine.outputs.matrix }}
233+
publish:
234+
needs: combine_results
235+
strategy:
236+
matrix: ${{ fromJson(needs.combine_results.outputs.matrix) }}
237+
uses: ./.github/workflows/mirror.yml
238+
with:
239+
version: ${{ matrix.version }}
240+
secrets: inherit

.github/workflows/nix-build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ jobs:
2424
arch: arm64
2525
- runner: macos-latest
2626
arch: arm64
27+
- runner: macos-13
28+
arch: amd64
2729
runs-on: ${{ matrix.runner }}
28-
30+
timeout-minutes: 180
2931
steps:
3032

3133
- name: Check out code
@@ -40,30 +42,31 @@ jobs:
4042
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
4143
aws-region: "us-east-1"
4244
output-credentials: true
45+
role-duration-seconds: 7200
4346
- name: write secret key
4447
# use python so we don't interpolate the secret into the workflow logs, in case of bugs
4548
run: |
4649
python -c "import os; file = open('nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
4750
env:
4851
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
4952
- name: Log in to Docker Hub
50-
if: matrix.runner != 'macos-latest'
53+
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
5154
uses: docker/login-action@v2
5255
with:
5356
username: ${{ secrets.DOCKER_USERNAME }}
5457
password: ${{ secrets.DOCKER_PASSWORD }}
5558
- name: Build psql bundle with nix
56-
if: matrix.runner != 'macos-latest'
59+
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
5760
run: docker build -t base_nix -f docker/nix/Dockerfile .
5861
- name: Run build psql bundle
59-
if: matrix.runner != 'macos-latest'
62+
if: matrix.runner != 'macos-latest' && matrix.runner != 'macos-13'
6063
run: |
6164
docker run -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} \
6265
-e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} \
6366
-e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} \
6467
base_nix bash -c "./workspace/docker/nix/build_nix.sh"
6568
- name: Build psql bundle on macos
66-
if: matrix.runner == 'macos-latest'
69+
if: matrix.runner == 'macos-latest' || matrix.runner == 'macos-13'
6770
run: |
6871
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm \
6972
--extra-conf "substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com" \

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
id: process_release_version
4343
run: |
4444
VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
45-
VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
45+
VERSION=$(echo $VERSION | tr -d '"') # Remove any surrounding quotes
4646
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
4747
VERSION=${{ inputs.postgresVersion }}
4848
fi
@@ -92,7 +92,7 @@ jobs:
9292
id: process_release_version
9393
run: |
9494
VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
95-
VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
95+
VERSION=$(echo $VERSION | tr -d '"') # Remove any surrounding quotes
9696
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
9797
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"
9898

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
- name: Grab release version
5050
id: process_release_version
5151
run: |
52-
VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
53-
VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
52+
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
53+
VERSION=$(echo $VERSION | tr -d '"') # Remove any surrounding quotes
5454
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
5555
VERSION=${{ inputs.postgresVersion }}
5656
fi
@@ -81,7 +81,6 @@ jobs:
8181
SLACK_COLOR: 'danger'
8282
SLACK_MESSAGE: 'Publishing pg_upgrade scripts failed'
8383
SLACK_FOOTER: ''
84-
8584
publish-prod:
8685
needs: prepare
8786
runs-on: ubuntu-latest
@@ -95,12 +94,17 @@ jobs:
9594
steps:
9695
- name: Checkout Repo
9796
uses: actions/checkout@v3
98-
97+
98+
- uses: DeterminateSystems/nix-installer-action@main
99+
99100
- name: Grab release version
100101
id: process_release_version
101102
run: |
102-
VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
103-
VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
103+
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
104+
VERSION=$(echo $VERSION | tr -d '"') # Remove any surrounding quotes
105+
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
106+
VERSION=${{ inputs.postgresVersion }}
107+
fi
104108
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
105109
106110
- name: Create a tarball containing pg_upgrade scripts

0 commit comments

Comments
 (0)