From 99e7b8bc0f1cb20e48628739ca94346bf60f8b04 Mon Sep 17 00:00:00 2001 From: Nitin Goyal Date: Thu, 14 Nov 2024 17:54:55 +0530 Subject: [PATCH] hack: check presence of the csv before running oc wait oc wait immediately exit if the resource is not present on the cluster. Make sure resources are present before running oc wait. Signed-off-by: Nitin Goyal --- hack/install-odf.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hack/install-odf.sh b/hack/install-odf.sh index 7158d0561..0da0e2daf 100755 --- a/hack/install-odf.sh +++ b/hack/install-odf.sh @@ -20,6 +20,15 @@ fi "$OPERATOR_SDK" run bundle "$BUNDLE_IMG" --timeout=10m --security-context-config restricted -n "$INSTALL_NAMESPACE" --index-image "$CATALOG_DEPS_IMG" +# Check for the presence of the CSVs in the cluster for up to 5 minutes, +# Since 'oc wait' exits immediately if the resource is not found. +for i in {1..30}; do + if oc get -n "$INSTALL_NAMESPACE" csv $CSV_NAMES &> /dev/null; then + break + fi + sleep 10 +done + oc wait --timeout=5m --for jsonpath='{.status.phase}'=Succeeded -n "$INSTALL_NAMESPACE" csv $CSV_NAMES || { echo "CSV $CSV_NAMES did not succeed, describing CSV"