5
5
inputs :
6
6
patch_id :
7
7
description : " ID of the Patch"
8
- required : false
8
+ required : true
9
9
major_version :
10
10
description : " PostgreSQL major version (leave empty for default)"
11
11
required : false
12
12
13
- # set up environment variables to be used across all the jobs
14
- env :
15
- REGISTRY : " ghcr.io/${{ github.repository_owner }}/postgresql-trunk"
16
- BRANCH : " master"
17
-
18
13
defaults :
19
14
run :
20
15
# default failure handling for shell scripts in 'run' steps
28
23
contents : read
29
24
packages : write
30
25
outputs :
31
- pg_image : " ${{ env.REGISTRY }}:${{ env.TAG }} "
26
+ images : ${{ env.IMAGES }}
32
27
steps :
33
28
- name : Checkout Code
34
29
uses : actions/checkout@v4
47
42
fi
48
43
49
44
- name : Set commitfest branch and tag
50
- if : github.event.inputs.patch_id != ''
51
45
run : |
52
46
BRANCH="cf/${{ github.event.inputs.patch_id }}"
53
- TAG="${{ env.PG_MAJOR }}-${ BRANCH////-}"
47
+ TAG="${BRANCH////-}"
54
48
echo "TAG=${TAG}" >> $GITHUB_ENV
55
49
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
56
50
@@ -61,17 +55,31 @@ jobs:
61
55
username : ${{ github.actor }}
62
56
password : ${{ secrets.GITHUB_TOKEN }}
63
57
58
+ - name : Set up Docker Buildx
59
+ uses : docker/setup-buildx-action@v3
60
+
64
61
- name : Build and push
65
- uses : docker/build-push-action@v6
62
+ uses : docker/bake-action@v6
63
+ id : build
64
+ env :
65
+ environment : production
66
+ registry : ghcr.io/${{ github.repository_owner }}
67
+ revision : ${{ github.sha }}
68
+ pgMajor : ${{ env.PG_MAJOR }}
66
69
with :
67
- context : .
70
+ set : |
71
+ *.args.PG_REPO=https://github.com/postgresql-cfbot/postgresql.git
72
+ *.args.PG_BRANCH=${{ env.BRANCH }}
73
+ minimal.tags=${{ env.registry }}/postgresql-trunk:18-minimal-${{ env.TAG }}
74
+ standard.tags=${{ env.registry }}/postgresql-trunk:18-standard-${{ env.TAG }}
75
+ postgis.tags=${{ env.registry }}/postgresql-trunk:18-postgis-${{ env.TAG }}
68
76
push : true
69
- load : false
70
- tags : |
71
- ${{ env.REGISTRY }}:${{ env.TAG }}
72
- build-args : |
73
- PG_REPO=https://github.com/postgresql-cfbot/postgresql.git
74
- PG_BRANCH=$ {{ env.BRANCH }}
77
+
78
+ # Get a list of the images that were built and pushed.
79
+ - name : Generated images
80
+ id : images
81
+ run : |
82
+ echo "IMAGES=$(echo '$ {{ steps.build.outputs.metadata }}' | jq -c '.[]."image.name"')" >> $GITHUB_ENV
75
83
76
84
generate-summary :
77
85
name : Commitfest Image Build summary
@@ -83,11 +91,15 @@ jobs:
83
91
run : |
84
92
commitFestPatchID=${{ github.event.inputs.patch_id }}
85
93
commitFestURL="https://commitfest.postgresql.org/patch/${commitFestPatchID}"
86
- image="${{ needs.build-pg.outputs.pg_image }}"
87
- imageURL="https://${image}"
94
+ image="${{ needs.build-pg.outputs.images }}"
95
+ images_list="$(echo $images | jq -r | tr ' ' '\n' | sed 's/^/https:\/\//')"
96
+ standardImage="$(echo $images | jq -r | grep standard)"
97
+
88
98
echo "# Commitfest Image Build summary" >> $GITHUB_STEP_SUMMARY
89
99
echo "**Commitfest Patch URL**: [$commitFestPatchID]($commitFestURL)" >> $GITHUB_STEP_SUMMARY
90
- echo "**Container Image**: [$image]($imageURL)" >> $GITHUB_STEP_SUMMARY
100
+ echo "Here's the list of Container Images that have been built:" >> $GITHUB_STEP_SUMMARY
101
+ echo "$images_list" >> $GITHUB_STEP_SUMMARY
102
+
91
103
echo "## CloudNativePG Cluster definition" >> $GITHUB_STEP_SUMMARY
92
104
echo "You can create a cluster in CloudNativePG running this image:" >> $GITHUB_STEP_SUMMARY
93
105
echo "\`\`\`sh" >> $GITHUB_STEP_SUMMARY
97
109
echo "metadata:" >> $GITHUB_STEP_SUMMARY
98
110
echo " name: commitfest-$commitFestPatchID" >> $GITHUB_STEP_SUMMARY
99
111
echo "spec:" >> $GITHUB_STEP_SUMMARY
100
- echo " imageName: $image " >> $GITHUB_STEP_SUMMARY
112
+ echo " imageName: $standardImage " >> $GITHUB_STEP_SUMMARY
101
113
echo " instances: 3" >> $GITHUB_STEP_SUMMARY
102
114
echo " storage:" >> $GITHUB_STEP_SUMMARY
103
115
echo " size: 1Gi" >> $GITHUB_STEP_SUMMARY
0 commit comments