@@ -71,61 +71,3 @@ for i in {1..30}; do
7171 kubectl get functionrevisions.pkg.crossplane.io -o wide
7272 fi
7373done
74-
75- # Check for the existence of the pod with the latest tag
76- echo " Checking for pod with the latest tag..."
77- for i in {1..30}; do
78- # List all pods with the function-xfuncjs label
79- echo " Listing all function-xfuncjs pods..."
80- kubectl get pods -n crossplane-system -l pkg.crossplane.io/function=function-xfuncjs -o wide || true
81-
82- # Check if any pod has the correct image and is in a valid state
83- # This command will output lines like: "pod-name image-name:tag Running/Succeeded"
84- POD_LIST=$( kubectl get pods -n crossplane-system -l pkg.crossplane.io/function=function-xfuncjs -o custom-columns=NAME:.metadata.name,IMAGE:.spec.containers[0].image,STATUS:.status.phase --no-headers 2> /dev/null || echo " " )
85-
86- if [ -z " $POD_LIST " ]; then
87- echo " No pods found for function-xfuncjs yet"
88- else
89- # Check each pod in the list
90- echo " $POD_LIST " | while read -r POD_LINE; do
91- if [ -z " $POD_LINE " ]; then
92- continue
93- fi
94-
95- # Extract pod name, image, and status
96- POD_NAME=$( echo " $POD_LINE " | awk ' {print $1}' )
97- POD_IMAGE=$( echo " $POD_LINE " | awk ' {print $2}' )
98- POD_STATUS=$( echo " $POD_LINE " | awk ' {print $3}' )
99-
100- echo " Checking pod: $POD_NAME , Image: $POD_IMAGE , Status: $POD_STATUS "
101-
102- if [[ " $POD_IMAGE " == * " ${TAG_TIMESTAMP} " * && (" $POD_STATUS " == " Running" || " $POD_STATUS " == " Succeeded" ) ]]; then
103- echo " Pod $POD_NAME is in a valid state with the correct image: $POD_IMAGE (Status: $POD_STATUS )"
104- # Set a flag to indicate we found a valid pod
105- touch /tmp/valid_pod_found
106- break
107- else
108- echo " Pod $POD_NAME found but either wrong image or not in a valid state yet:"
109- echo " - Image: $POD_IMAGE "
110- echo " - Status: $POD_STATUS "
111- fi
112- done
113-
114- # Check if we found a valid pod
115- if [ -f /tmp/valid_pod_found ]; then
116- rm /tmp/valid_pod_found
117- break
118- fi
119- fi
120-
121- echo " Waiting for pod with tag ${TAG_TIMESTAMP} to be ready... ($i /30)"
122- sleep 2
123-
124- # If we've waited too long, show the current state
125- if [ $i -eq 30 ]; then
126- echo " Current pods in crossplane-system namespace:"
127- kubectl get pods -n crossplane-system
128- fi
129- done
130-
131- echo " XFuncJS server deployed successfully with tag: ${TAG_TIMESTAMP} !"
0 commit comments