Skip to content

Commit 1d610c2

Browse files
committed
ci: use bake in continuos-deliver.yml
Signed-off-by: Niccolò Fei <[email protected]>
1 parent 99052d6 commit 1d610c2

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

.github/workflows/continuous-delivery.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
contents: read
3232
packages: write
3333
outputs:
34-
pg_image: ${{ env.TAG }}
34+
pg_image: ${{ env.PG_IMAGE }}
3535
pg_major: ${{ env.PG_MAJOR }}
3636
cnpg_branch: ${{ env.CNPG_BRANCH }}
3737
test_depth: ${{ env.TEST_DEPTH }}
@@ -59,26 +59,33 @@ jobs:
5959
echo "FEATURE_TYPE=${{ github.event.inputs.feature_type }}" >> $GITHUB_ENV
6060
fi
6161
62-
- name: Set tag
63-
run: |
64-
postgres_img="${{ env.REGISTRY }}:${{ env.PG_MAJOR }}-devel"
65-
echo "TAG=${postgres_img}" >> $GITHUB_ENV
66-
6762
- name: Log in to the GitHub Container registry
6863
uses: docker/login-action@v3
6964
with:
7065
registry: ghcr.io
7166
username: ${{ github.actor }}
7267
password: ${{ secrets.GITHUB_TOKEN }}
7368

74-
- name: Build and load
75-
uses: docker/build-push-action@v6
69+
- name: Set up Docker Buildx
70+
uses: docker/setup-buildx-action@v3
71+
72+
- name: Build and push
73+
uses: docker/bake-action@v6
74+
id: build
75+
env:
76+
environment: production
77+
registry: ghcr.io/${{ github.repository_owner }}
78+
revision: ${{ github.sha }}
79+
pgMajor: ${{ env.PG_MAJOR }}
7680
with:
77-
context: .
7881
push: true
79-
load: false
80-
tags: |
81-
${{ env.TAG }}
82+
83+
# Get a list of the images that were built and pushed. We only care about a single tag for each image.
84+
- name: Generated images
85+
id: images
86+
run: |
87+
echo '${{ steps.build.outputs.metadata }}' | jq -c '[ .[]."image.name"
88+
echo "PG_IMAGE=$(echo '${{ steps.build.outputs.metadata }}' | jq -c '[ .[]."image.name" | sub(",.*";"") ]')" >> "$GITHUB_ENV"
8289
8390
call-reusable-e2e:
8491
if: github.event_name == 'schedule'

defaults.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"PG_IMAGE": "ghcr.io/cloudnative-pg/postgresql-trunk:18-devel",
2+
"PG_IMAGE": "ghcr.io/cloudnative-pg/postgresql-trunk:18-standard-bookworm",
33
"PG_MAJOR": 18,
44
"CNPG_BRANCH": "main",
55
"TEST_DEPTH": 4,

docker-bake.hcl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ variable "revision" {
1919
default = "1"
2020
}
2121

22+
variable "pgMajor" {
23+
default = "18"
24+
}
25+
2226
fullname = ( environment == "testing") ? "${registry}/postgresql-trunk-testing" : "${registry}/postgresql-trunk"
2327
now = timestamp()
2428
title = "PostgreSQL Trunk Containers"
@@ -33,7 +37,7 @@ target "default" {
3337
"standard",
3438
"postgis"
3539
]
36-
pgMajor = ["18"]
40+
pgMajor = ["${pgMajor}"]
3741
base = ["debian:bookworm-slim"]
3842
}
3943

0 commit comments

Comments
 (0)