From adc0c12e9d6c3b88a5a0ff507548c615886701ca Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Tue, 15 Oct 2024 17:11:25 +0000
Subject: [PATCH] EuCNC24: Updated CI/CD pipeline

---
 src/tests/eucnc24/.gitlab-ci.yml | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/tests/eucnc24/.gitlab-ci.yml b/src/tests/eucnc24/.gitlab-ci.yml
index 0c958ec65..00c66e9d6 100644
--- a/src/tests/eucnc24/.gitlab-ci.yml
+++ b/src/tests/eucnc24/.gitlab-ci.yml
@@ -93,13 +93,24 @@ end2end_test eucnc24:
     - ./deploy/tfs.sh
     - ./deploy/show.sh
 
-    # Wait for Context to be subscribed to NATS
-    - >
-      while ! kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server 2>&1 | grep -q 'Subscriber is Ready? True'; do
-        kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server 2>&1;
-        sleep 1;
-      done
-    - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server
+    ## Wait for Context to be subscribed to NATS
+    ## WARNING: this loop is infinite if there is no subscriber (such as monitoring).
+    ##          Investigate if we can use a counter to limit the number of iterations.
+    ##          For now, keep it commented out.
+    #- LOOP_MAX_ATTEMPTS=180
+    #- LOOP_COUNTER=0
+    #- >
+    #  while ! kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server 2>&1 | grep -q 'Subscriber is Ready? True'; do
+    #    echo "Attempt: $LOOP_COUNTER"
+    #    kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server 2>&1;
+    #    sleep 1;
+    #    LOOP_COUNTER=$((LOOP_COUNTER + 1))
+    #    if [ "$LOOP_COUNTER" -ge "$LOOP_MAX_ATTEMPTS" ]; then
+    #      echo "Max attempts reached, exiting the loop."
+    #      break
+    #    fi
+    #  done
+    #- kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server
 
     # Run end-to-end tests
     - >
-- 
GitLab