Skip to content

Commit c49ae59

Browse files
authored
fix: add per image scope to gha cache (#745)
* chore: scope gha cache by image tag * chore: bump action runner version * chore: add runner arch to scope * chore: stop exporting extensions cache
1 parent 27e5449 commit c49ae59

File tree

8 files changed

+42
-46
lines changed

8 files changed

+42
-46
lines changed

.github/workflows/ami-release.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ jobs:
3535
with:
3636
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
3737
- run: docker context create builders
38-
- uses: docker/setup-buildx-action@v2
38+
- uses: docker/setup-buildx-action@v3
3939
with:
4040
endpoint: builders
41-
- uses: docker/build-push-action@v3
41+
- uses: docker/build-push-action@v5
4242
with:
43-
push: false
4443
load: true
4544
build-args: |
4645
${{ steps.args.outputs.result }}
4746
target: extensions
4847
tags: supabase/postgres:extensions
4948
platforms: linux/${{ matrix.arch }}
50-
cache-from: type=gha
51-
cache-to: type=gha,mode=max
49+
cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
50+
# No need to export extensions cache because latest depends on it
5251
- name: Extract built packages
5352
run: |
5453
mkdir -p /tmp/extensions ansible/files/extensions
@@ -60,9 +59,8 @@ jobs:
6059
- id: version
6160
run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT"
6261
- name: Build Postgres deb
63-
uses: docker/build-push-action@v3
62+
uses: docker/build-push-action@v5
6463
with:
65-
push: false
6664
load: true
6765
file: docker/Dockerfile
6866
target: pg-deb
@@ -74,8 +72,8 @@ jobs:
7472
CPPFLAGS=-mcpu=${{ matrix.mcpu }}
7573
tags: supabase/postgres:deb
7674
platforms: linux/${{ matrix.arch }}
77-
cache-from: type=gha
78-
cache-to: type=gha,mode=max
75+
cache-from: type=gha,scope=${{ github.ref_name }}-deb
76+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-deb
7977
- name: Extract Postgres deb
8078
run: |
8179
mkdir -p /tmp/build ansible/files/postgres

.github/workflows/build-ccache.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
image_digest: ${{ steps.build.outputs.digest }}
4545
steps:
4646
- run: docker context create builders
47-
- uses: docker/setup-buildx-action@v2
47+
- uses: docker/setup-buildx-action@v3
4848
with:
4949
endpoint: builders
5050
- name: Configure AWS credentials - prod
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
registry: public.ecr.aws
5858
- id: build
59-
uses: docker/build-push-action@v3
59+
uses: docker/build-push-action@v5
6060
with:
6161
push: true
6262
target: buildcache
@@ -70,7 +70,7 @@ jobs:
7070
needs: build_image
7171
runs-on: ubuntu-latest
7272
steps:
73-
- uses: docker/setup-buildx-action@v2
73+
- uses: docker/setup-buildx-action@v3
7474
- name: Configure AWS credentials - prod
7575
uses: aws-actions/configure-aws-credentials@v1
7676
with:

.github/workflows/collect-u18-binaries.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,20 @@ jobs:
4444
with:
4545
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
4646
- run: docker context create builders
47-
- uses: docker/setup-buildx-action@v2
47+
- uses: docker/setup-buildx-action@v3
4848
with:
49-
endpoint: builders
50-
- uses: docker/build-push-action@v3
49+
endpoint: builders
50+
- uses: docker/build-push-action@v5
5151
with:
52-
push: false
5352
load: true
5453
file: Dockerfile-u18
5554
build-args: |
5655
${{ steps.args.outputs.result }}
5756
target: extensions
5857
tags: supabase/postgres:extensions-u18
5958
platforms: linux/${{ matrix.arch }}
60-
cache-from: type=gha
61-
cache-to: type=gha,mode=max,ignore-error=true
59+
cache-from: type=gha,scope=${{ github.ref_name }}-extensions-u18
60+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-extensions-u18,ignore-error=true
6261

6362
- name: Extract built packages
6463
run: |
@@ -71,9 +70,8 @@ jobs:
7170
- id: version
7271
run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT"
7372
- name: Build Postgres deb
74-
uses: docker/build-push-action@v3
73+
uses: docker/build-push-action@v5
7574
with:
76-
push: false
7775
load: true
7876
file: docker/Dockerfile
7977
target: pg-deb
@@ -85,20 +83,19 @@ jobs:
8583
DEB_BUILD_PROFILES=pkg.postgresql.nozstd
8684
tags: supabase/postgres:deb-u18
8785
platforms: linux/${{ matrix.arch }}
88-
cache-from: type=gha
89-
cache-to: type=gha,mode=max,ignore-error=true
86+
cache-from: type=gha,scope=${{ github.ref_name }}-deb-u18
87+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-deb-u18,ignore-error=true
9088
- name: Extract Postgres deb
9189
run: |
9290
mkdir -p /tmp/build ansible/files/postgres
9391
docker save supabase/postgres:deb-u18 | tar xv -C /tmp/build
9492
for layer in /tmp/build/*/layer.tar; do
9593
tar xvf "$layer" -C ansible/files/postgres --strip-components 1
9694
done
97-
95+
9896
- name: Build surrogate Docker image
99-
uses: docker/build-push-action@v3
97+
uses: docker/build-push-action@v5
10098
with:
101-
push: false
10299
load: true
103100
file: Dockerfile-u18
104101
target: pg_binary_collection
@@ -109,8 +106,8 @@ jobs:
109106
postgresql_release=${{ steps.version.outputs.postgresql_release }}
110107
tags: supabase/postgres:u18-binaries
111108
platforms: linux/${{ matrix.arch }}
112-
cache-from: type=gha
113-
cache-to: type=gha,mode=max,ignore-error=true
109+
cache-from: type=gha,scope=${{ github.ref_name }}-u18-binaries
110+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-u18-binaries,ignore-error=true
114111

115112
- name: Copy binary tarball
116113
run: |

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ jobs:
4747
image_digest: ${{ steps.build.outputs.digest }}
4848
steps:
4949
- run: docker context create builders
50-
- uses: docker/setup-buildx-action@v2
50+
- uses: docker/setup-buildx-action@v3
5151
with:
5252
endpoint: builders
5353
- uses: docker/login-action@v2
5454
with:
5555
username: ${{ secrets.DOCKER_USERNAME }}
5656
password: ${{ secrets.DOCKER_PASSWORD }}
5757
- id: build
58-
uses: docker/build-push-action@v3
58+
uses: docker/build-push-action@v5
5959
with:
6060
file: docker/all-in-one/Dockerfile
6161
push: true
@@ -65,8 +65,8 @@ jobs:
6565
target: production
6666
tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }}
6767
platforms: linux/${{ matrix.arch }}
68-
cache-from: type=gha
69-
cache-to: type=gha,mode=max
68+
cache-from: type=gha,scope=${{ github.ref_name }}-aio-${{ matrix.arch }}
69+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-aio-${{ matrix.arch }}
7070
- name: Slack Notification
7171
if: ${{ failure() }}
7272
uses: rtCamp/action-slack-notify@v2
@@ -81,7 +81,7 @@ jobs:
8181
needs: [settings, build_image]
8282
runs-on: ubuntu-latest
8383
steps:
84-
- uses: docker/setup-buildx-action@v2
84+
- uses: docker/setup-buildx-action@v3
8585
- uses: docker/login-action@v2
8686
with:
8787
username: ${{ secrets.DOCKER_USERNAME }}

.github/workflows/dockerhub-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ jobs:
4040
image_digest: ${{ steps.build.outputs.digest }}
4141
steps:
4242
- run: docker context create builders
43-
- uses: docker/setup-buildx-action@v2
43+
- uses: docker/setup-buildx-action@v3
4444
with:
4545
endpoint: builders
4646
- uses: docker/login-action@v2
4747
with:
4848
username: ${{ secrets.DOCKER_USERNAME }}
4949
password: ${{ secrets.DOCKER_PASSWORD }}
5050
- id: build
51-
uses: docker/build-push-action@v3
51+
uses: docker/build-push-action@v5
5252
with:
5353
push: true
5454
build-args: |
5555
${{ needs.settings.outputs.build_args }}
5656
target: production
5757
tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }}
5858
platforms: linux/${{ matrix.arch }}
59-
cache-from: type=gha
60-
cache-to: type=gha,mode=max
59+
cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
60+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
6161
- name: Slack Notification
6262
if: ${{ failure() }}
6363
uses: rtCamp/action-slack-notify@v2
@@ -72,7 +72,7 @@ jobs:
7272
needs: [settings, build_image]
7373
runs-on: ubuntu-latest
7474
steps:
75-
- uses: docker/setup-buildx-action@v2
75+
- uses: docker/setup-buildx-action@v3
7676
- uses: docker/login-action@v2
7777
with:
7878
username: ${{ secrets.DOCKER_USERNAME }}

.github/workflows/package-plv8.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
image_digest: ${{ steps.build.outputs.digest }}
4444
steps:
4545
- run: docker context create builders
46-
- uses: docker/setup-buildx-action@v2
46+
- uses: docker/setup-buildx-action@v3
4747
with:
4848
endpoint: builders
4949
- uses: docker/login-action@v2
@@ -52,7 +52,7 @@ jobs:
5252
username: ${{ github.actor }}
5353
password: ${{ secrets.GITHUB_TOKEN }}
5454
- id: build
55-
uses: docker/build-push-action@v3
55+
uses: docker/build-push-action@v5
5656
with:
5757
push: true
5858
target: plv8-deb
@@ -64,7 +64,7 @@ jobs:
6464
needs: [settings, build_image]
6565
runs-on: ubuntu-latest
6666
steps:
67-
- uses: docker/setup-buildx-action@v2
67+
- uses: docker/setup-buildx-action@v3
6868
- uses: docker/login-action@v2
6969
with:
7070
registry: ghcr.io

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,21 @@ jobs:
2929
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
3030

3131
- run: docker context create builders
32-
- uses: docker/setup-buildx-action@v2
32+
- uses: docker/setup-buildx-action@v3
3333
with:
3434
endpoint: builders
35-
- uses: docker/build-push-action@v3
35+
- uses: docker/build-push-action@v5
3636
with:
37-
push: false
3837
load: true
3938
context: .
4039
target: production
4140
build-args: |
4241
${{ steps.args.outputs.result }}
4342
tags: supabase/postgres:latest
44-
cache-from: type=gha
45-
cache-to: type=gha,mode=max
43+
cache-from: |
44+
type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
45+
type=gha,scope=${{ github.base_ref }}-latest-${{ matrix.arch }}
46+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
4647

4748
- name: Start Postgres
4849
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1.5-labs
1+
# syntax=docker/dockerfile:1.6
22
ARG postgresql_major=15
33
ARG postgresql_release=${postgresql_major}.1
44

0 commit comments

Comments
 (0)