CICD-460 · Idle infrastructure detection
Encyclopedia · FinOps and resource optimization · All snippets
Previous · CICD-459 · Next · CICD-461
1. Where it fits
- Placement CI idle report.
- Prerequisites authorized read reports, explicit pricing period and reviewed ownership for cleanup.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
jq -r --arg end "$(date -u +%FT%TZ)" '.[] | select(.last_used_at!=null and .last_used_at < $end and .idle_hours >= 168 and .owner!=null) | .id' inventory.json3. How it works
The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate.
4. Verify the result
Report candidates with inventory evidence and owner review. Idle sampling does not imply decommission authorization.
Validation syntax-validated (Bash parse). Status definitions.