@@ -809,6 +809,59 @@ jobs:
809809
810810 echo "Pre-seed complete. Full provision will create the remaining model."
811811
812+ - name : Normalize ACA probe success thresholds
813+ run : |
814+ set -euo pipefail
815+
816+ RG_NAME="tutor-${AZURE_ENV_NAME}"
817+ SERVICES=(avatar chat configuration essays evaluation lms-gateway questions upskilling)
818+
819+ normalize_thresholds() {
820+ jq '
821+ .containers |= map(
822+ if ((.probes // null) == null) then
823+ .
824+ else
825+ .probes |= map(
826+ . + {
827+ successThreshold:
828+ (((.successThreshold // 1) | tonumber) as $s
829+ | if $s < 1 or $s > 10 then 1 else $s end)
830+ }
831+ )
832+ end
833+ )
834+ '
835+ }
836+
837+ for SERVICE in "${SERVICES[@]}"; do
838+ APP_NAME="tutor-${SERVICE}-${AZURE_ENV_NAME}"
839+ RID="$(az containerapp show -g "$RG_NAME" -n "$APP_NAME" --query id -o tsv 2>/dev/null || true)"
840+
841+ if [ -z "$RID" ]; then
842+ echo "Container app '$APP_NAME' not found. Skipping threshold normalization."
843+ continue
844+ fi
845+
846+ current_template="$(az rest --method get --url "https://management.azure.com${RID}?api-version=2024-03-01" --query properties.template -o json)"
847+ normalized_template="$(echo "$current_template" | normalize_thresholds)"
848+
849+ if [ "$(echo "$current_template" | jq -S .)" = "$(echo "$normalized_template" | jq -S .)" ]; then
850+ echo "Probe thresholds already valid for '$APP_NAME'."
851+ continue
852+ fi
853+
854+ patch_body="$(jq -n --argjson template "$normalized_template" '{properties:{template:$template}}')"
855+ echo "Patching probe thresholds for '$APP_NAME'..."
856+ az rest \
857+ --method patch \
858+ --url "https://management.azure.com${RID}?api-version=2024-03-01" \
859+ --body "$patch_body" \
860+ --output none
861+ done
862+
863+ echo "Probe threshold normalization complete."
864+
812865 - name : Provision infrastructure
813866 env :
814867 ARM_CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
@@ -1591,13 +1644,15 @@ jobs:
15911644 {
15921645 type: "Readiness",
15931646 httpGet: { path: "/health", port: 8000 },
1647+ successThreshold: 1,
15941648 failureThreshold: 3,
15951649 periodSeconds: 10,
15961650 timeoutSeconds: 5
15971651 },
15981652 {
15991653 type: "Startup",
16001654 httpGet: { path: "/health", port: 8000 },
1655+ successThreshold: 1,
16011656 failureThreshold: 30,
16021657 periodSeconds: 10,
16031658 timeoutSeconds: 5
0 commit comments