CICD-466 · Pipeline cost measurement
Encyclopedia · FinOps and resource optimization · All snippets
Previous · CICD-465 · Next · CICD-467
1. Where it fits
- Placement CI cost 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 -en --slurpfile jobs billing/job-usage.json --slurpfile rates billing/runner-rates.json '$rates[0] as $rate | $jobs[0] | map(. as $job | $job.billable_minutes * $rate[$job.sku]) | add'3. 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
Supply billed minutes and SKU prices in one currency. Compare the result against actual billing by runner family.
Validation syntax-validated (Bash parse). Status definitions.