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

  1. Your CI pipeline deploys code.
  2. After the deploy step, it sends a POST /deploys request to Cloudlink.
  3. 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.
  4. If the cost is up by 10% or more, Cloudlink creates a regression and sends a Slack alert and a regression.detected webhook, 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

SecretValue
CLOUDLINK_API_URLhttps://cloudlink-agents.onrender.com
CLOUDLINK_API_KEYYour 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:
    - main

Any 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

FieldRequiredDescription
serviceYesCost Explorer service name, e.g. "AWS Lambda"
deployed_atNoISO 8601 timestamp of the deploy (default: the time Cloudlink receives the request)
versionNoGit SHA, tag, or version number
environmentNoDeploy target (default: "production")
sourceNoCI system label (default: "api")
metadataNoAny 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.