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