ci: Use jq instead of bash arithmetic

jq's arithmetic is much more robust.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
Demi Marie Obenour
2026-04-09 13:39:55 -04:00
committed by Bo Chen
parent dcdf16b8ff
commit b8a61da06a

View File

@@ -93,11 +93,9 @@ jobs:
continue
fi
usage=$(az vm list-usage --location "$location" --query "[?name.value=='$family'] | [0]" -o json)
current=$(echo "$usage" | jq -r '.currentValue')
limit=$(echo "$usage" | jq -r '.limit')
if [[ $((limit - current)) -ge $vcpu ]]; then
remaining=$(az vm list-usage --location "$location" --query "[?name.value=='$family'] | [0]" -o json |
jq '.limit + 0 - .currentValue >= $ARGS.positional[0]' --jsonargs "$vcpu")
if [[ "$remaining" = true ]]; then
echo "Sufficient quota found in $location"
echo "location=$location" >> "$GITHUB_OUTPUT"
exit 0