Skip to content

Commit ec228b7

Browse files
committed
chore: fix binary collection; install .deb pg binaries on u18
1 parent 194dba7 commit ec228b7

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

.github/workflows/ami-build-ubuntu-18.yml

+62-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ on:
1818
workflow_dispatch:
1919

2020
jobs:
21-
build:
22-
runs-on: [self-hosted, X64]
21+
build:
22+
strategy:
23+
matrix:
24+
include:
25+
- runner: arm-runner
26+
arch: arm64
27+
ubuntu: focal
28+
mcpu: neoverse-n1
29+
runs-on: ${{ matrix.runner }}
2330
timeout-minutes: 150
2431
permissions:
2532
contents: write
@@ -28,8 +35,60 @@ jobs:
2835

2936
steps:
3037
- name: Checkout Repo
31-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
3239

40+
- id: args
41+
uses: mikefarah/yq@master
42+
with:
43+
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
44+
- run: docker context create builders
45+
- uses: docker/setup-buildx-action@v2
46+
with:
47+
endpoint: builders
48+
- uses: docker/build-push-action@v3
49+
with:
50+
push: false
51+
load: true
52+
build-args: |
53+
${{ steps.args.outputs.result }}
54+
target: extensions
55+
tags: supabase/postgres:extensions
56+
platforms: linux/${{ matrix.arch }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
- name: Extract built packages
60+
run: |
61+
mkdir -p /tmp/extensions ansible/files/extensions
62+
docker save supabase/postgres:extensions | tar xv -C /tmp/extensions
63+
for layer in /tmp/extensions/*/layer.tar; do
64+
tar xvf "$layer" -C ansible/files/extensions --strip-components 1
65+
done
66+
67+
- id: version
68+
run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT"
69+
- name: Build Postgres deb
70+
uses: docker/build-push-action@v3
71+
with:
72+
push: false
73+
load: true
74+
file: docker/Dockerfile
75+
target: pg-deb
76+
build-args: |
77+
ubuntu_release=${{ matrix.ubuntu }}
78+
postgresql_major=${{ steps.version.outputs.postgresql_major }}
79+
postgresql_release=${{ steps.version.outputs.postgresql_release }}
80+
CPPFLAGS=-mcpu=${{ matrix.mcpu }}
81+
tags: supabase/postgres:deb
82+
platforms: linux/${{ matrix.arch }}
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
85+
- name: Extract Postgres deb
86+
run: |
87+
mkdir -p /tmp/build ansible/files/postgres
88+
docker save supabase/postgres:deb | tar xv -C /tmp/build
89+
for layer in /tmp/build/*/layer.tar; do
90+
tar xvf "$layer" -C ansible/files/postgres --strip-components 1
91+
done
3392
- name: Build AMI
3493
run: |
3594
GIT_SHA=${{github.sha}}

ansible/tasks/internal/collect-pg-binaries.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- name: Collect Postgres binaries - collect shared files
1616
copy:
1717
remote_src: yes
18-
src: /var/lib/postgresql/
18+
src: /usr/share/postgresql/{{ postgresql_major }}/
1919
dest: /tmp/pg_binaries/{{ postgresql_major }}/share/
2020

2121
- name: Collect Postgres binaries - create tarfile

common.vars.pkr.hcl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.97"
1+
postgres-version = "15.1.0.98-rc0"

0 commit comments

Comments
 (0)