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.
This commit is contained in:
Viktor Barzin 2026-02-10 21:32:11 +00:00
parent 902f1b0852
commit a3ac9cc060
No known key found for this signature in database
GPG key ID: 0EB088298288D958

View file

@ -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