From 814fd379e22810ebeb67b62ae2de80ef75cbead0 Mon Sep 17 00:00:00 2001 From: Pierangelo Di Pilato Date: Fri, 17 Jan 2025 11:10:52 +0100 Subject: [PATCH] Ensure ImageContentSourcePolicy Signed-off-by: Pierangelo Di Pilato --- hack/install.sh | 1 + hack/lib/catalogsource.bash | 2 ++ hack/lib/images.bash | 2 +- hack/lib/serverless.bash | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hack/install.sh b/hack/install.sh index 0bab78450a..36ccd96a8d 100755 --- a/hack/install.sh +++ b/hack/install.sh @@ -23,5 +23,6 @@ create_namespaces "${SYSTEM_NAMESPACES[@]}" if [[ $INSTALL_CERTMANAGER == "true" ]]; then install_certmanager fi +ensure_content_source_policy ensure_catalogsource_installed ensure_serverless_installed diff --git a/hack/lib/catalogsource.bash b/hack/lib/catalogsource.bash index 2cadb174ea..f2328e94fe 100644 --- a/hack/lib/catalogsource.bash +++ b/hack/lib/catalogsource.bash @@ -165,6 +165,8 @@ EOF target_img=${img%-rhel*} fi + echo "Processing line: ${line}, image ${img} -> target image: ${target_img}" + local mirror1="${registry_target}/${target_img}" local mirror2="${registry_target_previous}/${target_img}" diff --git a/hack/lib/images.bash b/hack/lib/images.bash index 1b6150c649..85e9aeaf21 100755 --- a/hack/lib/images.bash +++ b/hack/lib/images.bash @@ -383,7 +383,7 @@ function image_with_sha { return_input_on_empty=${2:-"false"} # shellcheck disable=SC2086 - digest=$(skopeo inspect --retry-times=5 --no-tags=true ${SKOPEO_EXTRA_FLAGS} "docker://${image}" | jq -r '.Digest' || echo "") + digest=$(skopeo inspect --retry-times=10 --no-tags=true ${SKOPEO_EXTRA_FLAGS} "docker://${image}" | jq -r '.Digest' || echo "") if [ "${digest}" = "" ]; then if [ "${return_input_on_empty}" = "true" ]; then echo "${image}" diff --git a/hack/lib/serverless.bash b/hack/lib/serverless.bash index bc6c4bd2cb..baac3b6435 100644 --- a/hack/lib/serverless.bash +++ b/hack/lib/serverless.bash @@ -1,5 +1,10 @@ #!/usr/bin/env bash +function ensure_content_source_policy { + rootdir="$(dirname "$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")")" + oc apply -f "$rootdir/olm-catalog/serverless-operator-index/image_content_source_policy.yaml" +} + function ensure_serverless_installed { logger.info 'Check if Serverless is installed' if oc get knativeserving.operator.knative.dev knative-serving -n "${SERVING_NAMESPACE}" >/dev/null 2>&1 && \