fix: cost-audit.sh — Artifact Registry sizeBytes float-safe via awk
This commit is contained in:
parent
36195a2135
commit
79bb7c8625
|
|
@ -46,7 +46,6 @@ if [[ -z "$CR" ]]; then
|
|||
printf " ${OK} No services deployed\n"
|
||||
else
|
||||
while IFS=$'\t' read -r NAME URL; do
|
||||
# Check min-instances annotation
|
||||
MIN=$(gcloud run services describe "$NAME" \
|
||||
--project="${PROJECT_ID}" --region="${REGION}" \
|
||||
--format="value(spec.template.metadata.annotations.'autoscaling.knative.dev/minScale')" \
|
||||
|
|
@ -176,7 +175,8 @@ if [[ -z "$REPOS" ]]; then
|
|||
printf " ${OK} No Artifact Registry repos\n"
|
||||
else
|
||||
while IFS=$'\t' read -r NAME FMT SIZE; do
|
||||
SIZE_MB=$(( ${SIZE:-0} / 1048576 ))
|
||||
# sizeBytes kan være float (f.eks. 345900.5) — bruk awk for sikker MB-konvertering
|
||||
SIZE_MB=$(awk -v s="${SIZE:-0}" 'BEGIN { printf "%.1f", s / 1048576 }')
|
||||
printf " ${OK} %-28s fmt:%-8s size:${SIZE_MB} MB\n" "$NAME" "$FMT"
|
||||
done <<< "$REPOS"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user