From c383a8c436e7fee9b9c906c2100888b2126ad6ce Mon Sep 17 00:00:00 2001 From: Daniel Kiptoon Date: Fri, 23 Feb 2024 19:17:52 +0300 Subject: [PATCH] wait for all pods to get to running state Signed-off-by: Daniel Kiptoon --- .github/workflows/e2etests.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2etests.yml b/.github/workflows/e2etests.yml index a8e2d02b..3a2fc703 100644 --- a/.github/workflows/e2etests.yml +++ b/.github/workflows/e2etests.yml @@ -63,7 +63,8 @@ jobs: - name: Start Meshery Server using mesheryctl run: | curl -L https://meshery.io/install | ADAPTERS=meshery-istio PLATFORM=kubernetes bash - - + # mesheryctl system config minikube + kubectl wait --for=condition=Ready pod --all --all-namespaces --timeout=300s - name: Run minikube tunnel run: | echo 'Running minikube tunnel' @@ -109,6 +110,7 @@ jobs: done - name: Replace MeshSync run: | + # sleep 60 # # Set your deployment name, container name, new image version, and new image pull policy DEPLOYMENT_NAME="meshery-meshsync" CONTAINER_NAME="meshsync" @@ -122,13 +124,12 @@ jobs: kubectl patch -n meshery deployment meshery-meshsync -p '{"spec":{"template":{"spec":{"containers":[{"name":"meshsync","imagePullPolicy":"IfNotPresent", "image":"meshery-meshsync:test"}]}}}}' kubectl scale --replicas=1 deployment ${DEPLOYMENT_NAME} -n meshery kubectl rollout status deployment ${DEPLOYMENT_NAME} -n $NAMESPACE + kubectl get pods -A # Deploy pod kubectl run nginx-pod --image=nginx --labels=app=web,tier=frontend,purpose=meshsync-test - - # Check Meshery logs + kubectl wait --for=condition=Ready pod --all --all-namespaces --timeout=300s + kubectl get pods -A mesheryctl system logs meshery - - # Check MeshSync logs mesheryctl system logs meshsync CLUSTER_ID=$(kubectl get ns kube-system -o jsonpath='{.metadata.uid}') echo $CLUSTER_ID @@ -137,22 +138,20 @@ jobs: svcip="http://$(kubectl get svc -n meshery | grep "meshery " | tr -s ' ' | cut -d " " -f 3):9081" echo "this is $svcip" SECONDS=0 - end=$((SECONDS+300)) + end=$((SECONDS+420)) while [ $SECONDS -lt $end ]; do result=$(curl -s --location "${svcip}/api/system/meshsync/resources?kind=Pod&spec=true&annotations=true&labels=true&clusterIds=%5B\"${CLUSTER_ID}\"%5D&page=0&pagesize=25&search=&order=&sort=desc" \ --header "meshery-token: ${{ secrets.PROVIDER_TOKEN }}" \ --header "Cookie: meshery-provider=Meshery; token=${{ secrets.PROVIDER_TOKEN }}" | jq '.resources[].metadata.labels[] | select(.key == "purpose" and .value == "meshsync-test")') - # Check if the variable is empty (no match found) if [ -n "$result" ]; then echo "Match found: $result" break fi done - # Check if the loop completed its iterations without finding a match if [ -z "$result" ]; then echo "Error: MeshSync unable to discover resources." exit 1 fi - shell: bash + shell: bash \ No newline at end of file