diff --git a/apps/demo-nginx/Jenkinsfile b/apps/demo-nginx/Jenkinsfile index 1567cc1..77cd974 100644 --- a/apps/demo-nginx/Jenkinsfile +++ b/apps/demo-nginx/Jenkinsfile @@ -440,22 +440,24 @@ EOF echo "" echo "2. Checking running pod images..." - POD_IMAGES=$(kubectl get pods -n ${NAMESPACE} -l app=${APP_NAME} \ - -o jsonpath='{range .items[*]}{.spec.containers[0].image}{" "}{end}') + def POD_IMAGES = sh( + script: "kubectl get pods -n ${NAMESPACE} -l app=${APP_NAME} -o jsonpath='{range .items[*]}{.spec.containers[0].image}{\" \"}{end}'", + returnStdout: true + ).trim() echo " Running pod images:" - echo "${POD_IMAGES}" + echo " ${POD_IMAGES}" echo " Expected tag: ${IMAGE_TAG}" - if ! echo "${POD_IMAGES}" | grep -q "${IMAGE_TAG}"; then - echo " ❌ FAILED: Running pods do not use expected image!" - exit 1 - fi + if (!POD_IMAGES.contains(IMAGE_TAG)) { + error("❌ FAILED: Running pods do not use expected image!") + } echo " ✅ All running pods use expected image" + # 3. CRITICAL: Verify actual running pod images echo ""