For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configure CircleCI for Deploy Change Investigator

Send build and deployment webhooks to track changes

Send build and deployment data from CircleCI workflows to the Deploy Change Investigator using webhook steps.

Before you begin

  • Deploy Change Investigator setup: Build and deploy webhook integrations created in AI SRE. Go to Deploy Change Investigator to create webhook endpoints.

  • CircleCI project access: Permission to edit .circleci/config.yml and manage environment variables.

  • Webhook URLs: Build and deploy webhook URLs from the AI SRE integrations page.


Store webhook URLs as environment variables

Store webhook URLs securely in CircleCI project settings:

  1. Navigate to your project in the CircleCI dashboard

  2. Click Project Settings

  3. Select Environment Variables

  4. Click Add Environment Variable

  5. Create build webhook variable:

    • Name: AISRE_BUILD_WEBHOOK_URL

    • Value: Build webhook URL from AI SRE

  6. Click Add Environment Variable

  7. Create deploy webhook variable:

    • Name: AISRE_DEPLOY_WEBHOOK_URL

    • Value: Deploy webhook URL from AI SRE


Configure build webhooks

Add a webhook step to your build job after artifacts are published.

Docker build workflow


CircleCI environment variables

CircleCI provides these environment variables automatically:

Variable
Description
Example

CIRCLE_SHA1

Full commit SHA

ffac537e6cbbf934b08745a378932722df287a53

CIRCLE_BRANCH

Branch name

main

CIRCLE_PROJECT_REPONAME

Repository name

myapp

CIRCLE_PROJECT_USERNAME

GitHub or Bitbucket username

myorg

CIRCLE_REPOSITORY_URL

Git repository URL

https://github.com/myorg/myapp

CIRCLE_WORKFLOW_ID

Unique workflow identifier

abc123-def456-ghi789

CIRCLE_BUILD_NUM

Build number

1234

CIRCLE_USERNAME

User who triggered build

username

Access variables using shell syntax: $CIRCLE_SHA1


Configure deploy webhooks

Add webhook steps to deployment jobs after deployment completes.

Kubernetes deployment workflow

DEPLOY STATUS IS RECORDED AS SUCCESS

The stock Harness Deployment template records every deploy activity as success. Sending a FAILURE status is accepted but does not create a failed-deployment record. Keep the failure webhook if you want the deploy event captured, but do not rely on the status value to distinguish failed deploys.


Step execution conditions

Control when steps execute using when attribute:

Condition
When it runs

when: on_success

Previous steps succeeded

when: on_fail

Previous steps failed

when: always

Runs regardless of status

Example with conditions:


Multi-service deployments

For workflows that deploy multiple services, send all services in one webhook:


Reusable commands

Create reusable commands to standardize webhook notifications:


Workflow filters

Control which branches trigger jobs using filters:


Map services and versions

The Deploy Change Investigator requires exact matches between build and deploy webhooks:

Build webhook
Deploy webhook
Must match

service.name

services[].service

✅ Required

artifact.version or service.version

services[].version

✅ Required

Use the same variable ($CIRCLE_SHA1) in both build and deploy webhooks to ensure versions match.


Testing webhooks

Test build webhook

Trigger a build and confirm the build webhook reaches AI SRE:

  1. Push a commit to trigger a build

  2. Check build logs for the webhook step

  3. Verify the curl command executed successfully

  4. Navigate to AI SRE, then select Integrations

  5. Click the More icon on the BUILD integration

  6. Select Debug

  7. Verify the webhook appears with the correct payload

Test deploy webhook

Run a deployment and confirm the deploy webhook reaches AI SRE:

  1. Trigger the deployment workflow

  2. Check the deployment job logs

  3. Navigate to AI SRE, then select Integrations

  4. Click the More icon on the DEPLOY integration

  5. Select Debug

  6. Verify the webhook appears

Verify correlation

After sending both webhooks:

  1. Navigate to AI SRE, then select Change Management

  2. Deployments should appear linked to builds

  3. Click a deployment to see artifact versions and commit information


Troubleshooting

CircleCI webhook not received in AI SRE

Confirm the environment variable AISRE_BUILD_WEBHOOK_URL or AISRE_DEPLOY_WEBHOOK_URL is configured, verify the curl command runs in the job logs, ensure CircleCI executors allow outbound HTTPS, and check the JSON payload for syntax errors. Test manually with curl -v -X POST against the webhook URL.

CircleCI deployments not linked to builds in AI SRE

Ensure services[].service in the deploy webhook exactly matches service.name in the build webhook, and services[].version exactly matches the build webhook version. Confirm both webhooks were sent successfully by checking the Debug view.

CircleCI shell variable interpolation issues in webhook JSON

Shell variables may not expand in JSON. Use the quote pattern \"'\"$VARIABLE\"'\" for proper JSON escaping, for example \"service\": \"'\"$CIRCLE_PROJECT_REPONAME\"'\".


Next steps

Last updated

Was this helpful?