Skip to content

Commit 3c9243d

Browse files
NiccoloFeifcanovai
andauthored
ci: select a single UBI tag during the OLM release process (cloudnative-pg#7411)
Closes cloudnative-pg#7385 Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com> Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com> Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
1 parent e56753a commit 3c9243d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/release-publish.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
author_name: ${{ steps.build-meta.outputs.author_name }}
9797
author_email: ${{ steps.build-meta.outputs.author_email }}
9898
platforms: ${{ env.PLATFORMS }}
99-
ubi_img: ${{ fromJSON(steps.bake-push.outputs.metadata)['ubi']['image.name'] }}
99+
olm_img: ${{ steps.olm-image.outputs.olm_image }}
100100
steps:
101101
-
102102
name: Checkout
@@ -214,12 +214,23 @@ jobs:
214214
# See https://github.blog/security/supply-chain-security/safeguard-container-signing-capability-actions/
215215
# and https://github.com/actions/starter-workflows/blob/main/ci/docker-publish.yml for more details on
216216
# how to use cosign.
217-
- name: Sign images
217+
-
218+
name: Sign images
218219
run: |
219220
images=$(echo '${{ steps.bake-push.outputs.metadata }}' |
220221
jq -r '.[] | (."image.name" | sub(",.*";"" )) + "@" + ."containerimage.digest"'
221222
)
222223
cosign sign --yes ${images}
224+
-
225+
# Bake returns all the tags for a target's variant in a comma separated list.
226+
# We only care about a single tag for OLM, so we remove the "latest" tag and
227+
# pick the first entry in order from what's left in the list
228+
name: Image for OLM
229+
id: olm-image
230+
env:
231+
ubi_tags: ${{ fromJSON(steps.bake-push.outputs.metadata)['ubi']['image.name'] }}
232+
run: |
233+
echo "olm_image=$(echo "$ubi_tags" | tr ',' '\n' | grep -v 'latest' | sed 's/^ *//g' | head -n 1)" >> $GITHUB_OUTPUT
223234
224235
olm-bundle:
225236
name: Create OLM bundle and catalog
@@ -261,11 +272,11 @@ jobs:
261272

262273
- name: Set bundle variables
263274
env:
264-
UBI_IMG: ${{ needs.release-binaries.outputs.ubi_img }}
275+
OLM_IMG: ${{ needs.release-binaries.outputs.olm_img }}
265276
run: |
266-
echo "CONTROLLER_IMG=${UBI_IMG}" >> $GITHUB_ENV
267-
echo "BUNDLE_IMG=${UBI_IMG}-bundle" >> $GITHUB_ENV
268-
echo "CATALOG_IMG=${UBI_IMG}-catalog" >> $GITHUB_ENV
277+
echo "CONTROLLER_IMG=${OLM_IMG}" >> $GITHUB_ENV
278+
echo "BUNDLE_IMG=${OLM_IMG}-bundle" >> $GITHUB_ENV
279+
echo "CATALOG_IMG=${OLM_IMG}-catalog" >> $GITHUB_ENV
269280
270281
- name: Create bundle
271282
env:

0 commit comments

Comments
 (0)