@@ -296,24 +296,8 @@ function latest_registry_redhat_io_image_sha() {
296
296
exit 1
297
297
fi
298
298
299
- digest=" ${image##*@ } " # Get only sha
300
-
301
- image_name=${image_without_tag##*/ } # Get image name after last slash
302
-
303
- # Add rhel suffix
304
- if [ " ${image_name} " == " serverless-openshift-kn-operator" ]; then
305
- # serverless-openshift-kn-operator is special, as it has rhel in the middle of the name
306
- # see https://redhat-internal.slack.com/archives/CKR568L8G/p1729684088850349
307
- image_name=" serverless-openshift-kn-rhel$( get_serverless_operator_rhel_version) -operator"
308
- elif [ " ${image_name} " == " serverless-bundle" ]; then
309
- # serverless-bundle is special, as it has no rhelXYZ in the name
310
- image_name=" serverless-bundle"
311
- else
312
- # for other images simply add it as a suffix
313
- image_name=" ${image_name} -rhel$( get_serverless_operator_rhel_version) "
314
- fi
315
-
316
- echo " ${registry_redhat_io} /${image_name} @${digest} "
299
+ rh_registry_image=" $( get_rh_registry_image_ref " $image " ) "
300
+ echo " $rh_registry_image "
317
301
}
318
302
319
303
function latest_konflux_image_sha() {
@@ -355,3 +339,62 @@ function get_app_version_from_tag() {
355
339
app_version=${app_version/ ./ } # -> 134
356
340
echo " ${app_version} "
357
341
}
342
+
343
+ # returns the quay image for a given rh registry image ref
344
+ function get_quay_image_ref() {
345
+ local rh_registry_image_ref
346
+ rh_registry_image_ref=" ${1} "
347
+
348
+ if [[ $rh_registry_image_ref =~ $registry_redhat_io ]]; then
349
+ image=${rh_registry_image_ref##*/ } # Get image name after last slash
350
+ image_sha=${image##*@ } # Get SHA of image
351
+ image_name=${image%@* } # Remove sha
352
+
353
+ if [[ " ${image_name} " =~ ^serverless-openshift-kn-rhel[0-9]+-operator$ ]]; then
354
+ # serverless-openshift-kn-operator is special, as it has rhel in the middle of the name
355
+ # see https://redhat-internal.slack.com/archives/CKR568L8G/p1729684088850349
356
+ component=" serverless-openshift-kn-operator"
357
+ elif [[ " ${image_name} " == " serverless-operator-bundle" ]]; then
358
+ # serverless-operator-bundle is special, as it is named only serverless-bundle in quay
359
+ component=" serverless-bundle"
360
+ else
361
+ # for other images simply remove the -rhelXYZ suffix
362
+ component=${image_name% -rhel* }
363
+ fi
364
+
365
+ echo " ${registry_quay} /${component} @${image_sha} "
366
+ else
367
+ echo " Image must be from ${registry_redhat_io} , got ${rh_registry_image_ref} "
368
+ return 1
369
+ fi
370
+ }
371
+
372
+ # returns the RH registry image for a given quay image ref
373
+ function get_rh_registry_image_ref() {
374
+ local quay_registry_image_ref
375
+ quay_registry_image_ref=" ${1} "
376
+
377
+ if [[ $quay_registry_image_ref =~ $registry_quay ]]; then
378
+ image=${quay_registry_image_ref##*/ } # Get image name after last slash
379
+ image_sha=${image##*@ } # Get SHA of image
380
+ image_name=${image%@* } # Remove sha
381
+
382
+ # Add rhel suffix
383
+ if [ " ${image_name} " == " serverless-openshift-kn-operator" ]; then
384
+ # serverless-openshift-kn-operator is special, as it has rhel in the middle of the name
385
+ # see https://redhat-internal.slack.com/archives/CKR568L8G/p1729684088850349
386
+ image_name=" serverless-openshift-kn-rhel$( get_serverless_operator_rhel_version) -operator"
387
+ elif [ " ${image_name} " == " serverless-bundle" ]; then
388
+ # serverless-bundle is special, as it has no rhelXYZ in the name
389
+ image_name=" serverless-bundle"
390
+ else
391
+ # for other images simply add it as a suffix
392
+ image_name=" ${image_name} -rhel$( get_serverless_operator_rhel_version) "
393
+ fi
394
+
395
+ echo " ${registry_redhat_io} /${image_name} @${image_sha} "
396
+ else
397
+ echo " Image must be from ${registry_quay} , got ${quay_registry_image_ref} "
398
+ return 1
399
+ fi
400
+ }
0 commit comments