From a3ac9cc060209c5162fbd9436f7d0a7331cb6d1a Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Tue, 10 Feb 2026 21:32:11 +0000 Subject: [PATCH] Fix Drone CI variable interpolation in API verify-deploy step Drone expands ${VAR} as its own variables before the shell runs, so ${BASE_API} and ${DEPLOY} were replaced with empty strings. Use $VAR (no braces) so the shell handles them instead. Also add fallback for empty jq output to prevent "sh: out of range" errors. --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index d37af44..0c4ea4d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -152,7 +152,7 @@ steps: for DEPLOY in realestate-crawler-api realestate-crawler-celery realestate-crawler-celery-beat; do echo "Verifying $DEPLOY..." - PODS_API="${BASE_API}?labelSelector=app%3D${DEPLOY}" + PODS_API="$BASE_API?labelSelector=app%3D$DEPLOY" FOUND=0 for i in $(seq 1 60); do @@ -165,10 +165,10 @@ steps: (.spec.containers[]? | .image == $img) ) | {name: .metadata.name, age: (now - (.status.startTime | fromdateiso8601) | floor), image: .spec.containers[0].image, started: .status.startTime}]') - COUNT=$(echo "$RESULT" | jq 'length') + COUNT=$(echo "$RESULT" | jq 'length' 2>/dev/null || echo 0) echo " Attempt $i/60: $COUNT pod(s) younger than 60s, ready, running $EXPECTED_IMAGE" - if [ "$COUNT" -gt 0 ]; then + if [ "$COUNT" -gt 0 ] 2>/dev/null; then echo "$RESULT" | jq -r '.[] | " \(.name) age=\(.age)s image=\(.image) started=\(.started)"' echo "$DEPLOY is live!" FOUND=1