From b8a61da06af84bd441c963bdff019aa093ffb684 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Thu, 9 Apr 2026 13:39:55 -0400 Subject: [PATCH] ci: Use jq instead of bash arithmetic jq's arithmetic is much more robust. Signed-off-by: Demi Marie Obenour --- .github/workflows/mshv-infra.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mshv-infra.yaml b/.github/workflows/mshv-infra.yaml index 24ee2a59c..6e15c212e 100644 --- a/.github/workflows/mshv-infra.yaml +++ b/.github/workflows/mshv-infra.yaml @@ -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