From 22ac115a10681102501645a334dea3fd06ac1f20 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Fri, 17 Jan 2025 14:44:24 -0800 Subject: [PATCH] waiting for registered manifests Signed-off-by: lakshmimsft --- .github/workflows/functional-test-cloud.yaml | 43 +++++++++++++++++++ .../workflows/functional-test-noncloud.yaml | 43 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/.github/workflows/functional-test-cloud.yaml b/.github/workflows/functional-test-cloud.yaml index a15b0c6e22..2613e5c616 100644 --- a/.github/workflows/functional-test-cloud.yaml +++ b/.github/workflows/functional-test-cloud.yaml @@ -657,6 +657,49 @@ jobs: --set global.azureWorkloadIdentity.enabled=true \ --set global.aws.irsa.enabled=true + echo "*** Verify manifests are registered ***" + rm -f registermanifest_logs.txt + # Find the pod with container "ucp" + POD_NAME=$( + kubectl get pods -n radius-system \ + -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[*].name}{"\n"}{end}' \ + | grep "ucp" \ + | head -n1 \ + | cut -d" " -f1 + ) + echo "Found ucp pod: $POD_NAME" + + if [ -z "$POD_NAME" ]; then + echo "No pod with container 'ucp' found in namespace radius-system." + exit 1 + fi + + # Poll logs for up to iterations, 30 seconds each (upto 3 minutes total) + for i in {1..6}; do + kubectl logs "$POD_NAME" -n radius-system | tee registermanifest_logs.txt > /dev/null + + # Exit on error + if grep -qi "error" registermanifest_logs.txt; then + echo "Error found in ucp logs." + exit 1 + fi + + # Check for success + if grep -q "Successfully registered manifests" registermanifest_logs.txt; then + echo "Successfully registered manifests - message found." + break + fi + + echo "Logs not ready, waiting 30 seconds..." + sleep 30 + done + + # Final check to ensure success message was found + if ! grep -q "Successfully registered manifests" registermanifest_logs.txt; then + echo "Manifests not registered after 3 minutes." + exit 1 + fi + echo "*** Create workspace, group and environment for test ***" rad workspace create kubernetes rad group create kind-radius diff --git a/.github/workflows/functional-test-noncloud.yaml b/.github/workflows/functional-test-noncloud.yaml index a0af5c4844..0ff7586d9b 100644 --- a/.github/workflows/functional-test-noncloud.yaml +++ b/.github/workflows/functional-test-noncloud.yaml @@ -290,6 +290,49 @@ jobs: echo "*** Installing Radius to Kubernetes ***" eval $RAD_COMMAND + echo "*** Verify manifests are registered ***" + rm -f registermanifest_logs.txt + # Find the pod with container "ucp" + POD_NAME=$( + kubectl get pods -n radius-system \ + -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[*].name}{"\n"}{end}' \ + | grep "ucp" \ + | head -n1 \ + | cut -d" " -f1 + ) + echo "Found ucp pod: $POD_NAME" + + if [ -z "$POD_NAME" ]; then + echo "No pod with container 'ucp' found in namespace radius-system." + exit 1 + fi + + # Poll logs for up to iterations, 30 seconds each (upto 3 minutes total) + for i in {1..6}; do + kubectl logs "$POD_NAME" -n radius-system | tee registermanifest_logs.txt > /dev/null + + # Exit on error + if grep -qi "error" registermanifest_logs.txt; then + echo "Error found in ucp logs." + exit 1 + fi + + # Check for success + if grep -q "Successfully registered manifests" registermanifest_logs.txt; then + echo "Successfully registered manifests - message found." + break + fi + + echo "Logs not ready, waiting 30 seconds..." + sleep 30 + done + + # Final check to ensure success message was found + if ! grep -q "Successfully registered manifests" registermanifest_logs.txt; then + echo "Manifests not registered after 3 minutes." + exit 1 + fi + echo "*** Create workspace, group and environment for test ***" rad workspace create kubernetes rad group create kind-radius