CI Integration
Send deploy events from your CI/CD pipeline so Cloudlink can compare a service's cost before and after each release.
How it works
- Your CI pipeline deploys code.
- After the deploy step, it sends a
POST /deploysrequest to Cloudlink. - Once the deploy is at least 2 hours old, Cloudlink compares the service's average hourly cost before the deploy with its average hourly cost in the hours right after it. Detection runs every 30 minutes by default.
- If the cost is up by 10% or more, Cloudlink creates a regression and sends a Slack alert and a
regression.detectedwebhook, if you have set those up.
This needs hourly cost data from Cost Explorer. See Cost data.
Use Cost Explorer service names
The service field must match a Cost Explorer service name exactly (for example AWS Lambda), because Cloudlink compares it against hourly cost by service. A name that doesn't match has no cost data, so no regression can be found for it. To see the names Cloudlink has data for, call:
curl https://cloudlink-agents.onrender.com/cost-snapshots/services \ -H "Authorization: Bearer YOUR_API_KEY"
GitHub Actions
Add this step after your deploy step:
- name: Notify Cloudlink
if: success()
run: |
curl -s -X POST ${{ secrets.CLOUDLINK_API_URL }}/deploys \
-H "Authorization: Bearer ${{ secrets.CLOUDLINK_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"service": "AWS Lambda",
"version": "${{ github.sha }}",
"environment": "production",
"source": "github-actions"
}'Required secrets
| Secret | Value |
|---|---|
CLOUDLINK_API_URL | https://cloudlink-agents.onrender.com |
CLOUDLINK_API_KEY | Your Cloudlink API key |
GitLab CI
notify_cloudlink:
stage: post-deploy
script:
- |
curl -s -X POST $CLOUDLINK_API_URL/deploys \
-H "Authorization: Bearer $CLOUDLINK_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"service\": \"AWS Lambda\",
\"version\": \"$CI_COMMIT_SHA\",
\"environment\": \"production\",
\"source\": \"gitlab-ci\"
}"
only:
- mainAny other CI system
Anything that can make an HTTP request can send deploy events:
curl -X POST https://cloudlink-agents.onrender.com/deploys \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"service": "AWS Lambda",
"version": "v1.2.3",
"environment": "production"
}'The response is { "deploy_id": "...", "service": "...", "deployed_at": "..." }.
Deploy event fields
| Field | Required | Description |
|---|---|---|
service | Yes | Cost Explorer service name, e.g. "AWS Lambda" |
deployed_at | No | ISO 8601 timestamp of the deploy (default: the time Cloudlink receives the request) |
version | No | Git SHA, tag, or version number |
environment | No | Deploy target (default: "production") |
source | No | CI system label (default: "api") |
metadata | No | Any JSON object for your own tracking |
Checking it works
After sending a deploy event, open Dashboard → Deploys to confirm it appeared. You can click Run detection there to run regression detection right away instead of waiting for the next scheduled run. A deploy is only analysed once it is at least 2 hours old and there is hourly cost data from after it.