From castai-pack
Integrates CAST AI cost checks and policy validation into GitHub Actions CI/CD pipelines. Verifies Kubernetes savings thresholds, agent health, and Terraform plans before deployment.
How this skill is triggered — by the user, by Claude, or both
Slash command
/castai-pack:castai-ci-integrationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Add CAST AI cost validation to CI/CD pipelines: verify savings thresholds, validate Terraform plans before apply, and gate deployments on autoscaler health.
Add CAST AI cost validation to CI/CD pipelines: verify savings thresholds, validate Terraform plans before apply, and gate deployments on autoscaler health.
# .github/workflows/castai-check.yml
name: CAST AI Cost Check
on:
pull_request:
paths: ["terraform/**", "k8s/**"]
schedule:
- cron: "0 8 * * 1" # Weekly Monday report
jobs:
cost-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check CAST AI Savings
env:
CASTAI_API_KEY: ${{ secrets.CASTAI_API_KEY }}
CASTAI_CLUSTER_ID: ${{ secrets.CASTAI_CLUSTER_ID }}
run: |
SAVINGS=$(curl -s -H "X-API-Key: ${CASTAI_API_KEY}" \
"https://api.cast.ai/v1/kubernetes/clusters/${CASTAI_CLUSTER_ID}/savings")
PERCENT=$(echo "$SAVINGS" | jq -r '.savingsPercentage')
MONTHLY=$(echo "$SAVINGS" | jq -r '.monthlySavings')
echo "### CAST AI Savings Report" >> $GITHUB_STEP_SUMMARY
echo "- Monthly savings: \$${MONTHLY}" >> $GITHUB_STEP_SUMMARY
echo "- Savings percentage: ${PERCENT}%" >> $GITHUB_STEP_SUMMARY
# Fail if savings drop below threshold
if (( $(echo "$PERCENT < 10" | bc -l) )); then
echo "WARNING: Savings below 10% threshold"
exit 1
fi
- name: Verify Agent Health
env:
CASTAI_API_KEY: ${{ secrets.CASTAI_API_KEY }}
CASTAI_CLUSTER_ID: ${{ secrets.CASTAI_CLUSTER_ID }}
run: |
STATUS=$(curl -s -H "X-API-Key: ${CASTAI_API_KEY}" \
"https://api.cast.ai/v1/kubernetes/external-clusters/${CASTAI_CLUSTER_ID}" \
| jq -r '.agentStatus')
if [ "$STATUS" != "online" ]; then
echo "CAST AI agent is ${STATUS}, expected online"
exit 1
fi
terraform-plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Terraform Init & Plan
working-directory: terraform/
env:
CASTAI_API_TOKEN: ${{ secrets.CASTAI_API_KEY }}
run: |
terraform init
terraform plan -var-file=environments/prod.tfvars \
-out=plan.tfplan -no-color | tee plan-output.txt
- name: Check for Destructive Changes
run: |
if grep -q "will be destroyed" terraform/plan-output.txt; then
echo "DESTRUCTIVE CHANGES DETECTED in CAST AI resources"
exit 1
fi
gh secret set CASTAI_API_KEY --body "your-api-key"
gh secret set CASTAI_CLUSTER_ID --body "your-cluster-id"
| Issue | Cause | Solution |
|---|---|---|
| Secret not found | Missing gh secret set | Add secrets to repo |
| Savings check fails | Cluster not onboarded | Verify cluster ID is correct |
| Terraform init fails | State backend misconfigured | Check backend config |
| Agent offline in CI | Key scope mismatch | Use production API key |
For deployment patterns, see castai-deploy-integration.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin castai-packSets up local Kubernetes dev loop with CAST AI cost monitoring for testing autoscaler policies and iterating Terraform configs.
Automates security scanning for IaC templates (Terraform, CloudFormation, K8s) using Checkov, tfsec, and KICS to detect misconfigurations before deployment.
Provides production DevOps patterns for GitHub Actions CI/CD, Docker multi-stage builds, Kubernetes, Terraform IaC, OpenTelemetry observability, GitOps, security scanning, and cost optimization.