Cloptima CLI for CI/CD Cost Guardrails
Why Add Cost Checks to CI/CD
Cost regressions are cheapest to catch before deployment. CLI checks let teams validate spend impact alongside unit tests, security scans, and performance gates in a single release workflow.
Create a Pipeline Token
Create a Personal Access Token from your Cloptima settings for the target organization and store it as CLOPTIMA_ACCESS_TOKEN in your CI secret manager. Rotate tokens periodically and scope access to least privilege.
Use Deterministic Command Inputs
Pass UUIDs for cloud-account-id and cluster-id in CI to avoid name ambiguity. In scripts, always set --output json and parse structured fields rather than relying on human-readable table output.
Typical Pipeline Checks
Common checks include: failing when active anomalies exceed a threshold, blocking deploys when projected costs exceed policy limits, and exporting recommendations as build artifacts for follow-up.
Example Workflow Pattern
Step 1: run cloptima costs with a fixed date window. Step 2: run cloptima anomalies and parse JSON severity counts. Step 3: run cloptima recommend and attach output to PR/build logs. Step 4: fail pipeline when policy conditions are met.
Operational Best Practices
Use separate tokens per environment, keep immutable build logs for auditability, and alert owners with structured outputs (Slack/Jira/GitHub checks). Treat cost guardrails like security gates: measurable, automated, and reviewed regularly.