Deployment Change Tracking

CircleCI + Alert24: Deployment Change Tracking

Log every CircleCI deployment to Alert24's change log with a single when:on_success step. Includes context setup and orb-based workflow pattern.

CircleCI's when: on_success step condition lets you add a logging step that only fires when the deployment succeeds. Store your Alert24 API key as a CircleCI context or project environment variable and log every deploy in one line.

Before you start

You'll need:

  • An Alert24 API key with write scope, stored as a CircleCI environment variable (ALERT24_API_KEY) in your project settings or a shared context
  • An existing CircleCI workflow with a deploy job

Add to your config

# .circleci/config.yml
version: 2.1

jobs:
  deploy:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - run:
          name: Deploy application
          command: ./scripts/deploy.sh

      - run:
          name: Log deployment to Alert24
          when: on_success
          command: |
            curl -s -X POST https://app.alert24.net/api/v1/changes \
              -H "Authorization: Bearer $ALERT24_API_KEY" \
              -H "Content-Type: application/json" \
              -d "{
                \"summary\": \"Deployed $CIRCLE_PROJECT_REPONAME @ ${CIRCLE_SHA1:0:8}\",
                \"change_type\": \"deployment\",
                \"environment\": \"production\",
                \"branch\": \"$CIRCLE_BRANCH\",
                \"commit_sha\": \"$CIRCLE_SHA1\",
                \"pipeline_url\": \"$CIRCLE_BUILD_URL\",
                \"changed_by\": \"$CIRCLE_USERNAME\",
                \"source\": \"circleci\",
                \"tags\": [\"circleci\", \"$CIRCLE_BRANCH\"]
              }"

workflows:
  deploy:
    jobs:
      - deploy:
          filters:
            branches:
              only: main
          context: alert24

Using CircleCI orbs

If you wrap your deploy logic in an orb, add the Alert24 step as the last command in the orb's deploy command, or add it as a job in the workflow after the deploy job:

workflows:
  deploy:
    jobs:
      - my-org/deploy:
          name: deploy-production
      - notify-alert24:
          requires: [deploy-production]

jobs:
  notify-alert24:
    docker:
      - image: cimg/base:stable
    steps:
      - run:
          name: Log to Alert24
          command: |
            curl -s -X POST https://app.alert24.net/api/v1/changes \
              -H "Authorization: Bearer $ALERT24_API_KEY" \
              -H "Content-Type: application/json" \
              -d "{
                \"summary\": \"Deployed $CIRCLE_PROJECT_REPONAME\",
                \"environment\": \"production\",
                \"source\": \"circleci\"
              }"

Key CircleCI variables

CircleCI variable Alert24 field
$CIRCLE_SHA1 commit_sha
$CIRCLE_BRANCH branch
$CIRCLE_BUILD_URL pipeline_url
$CIRCLE_USERNAME changed_by
$CIRCLE_PROJECT_REPONAME Part of summary
$CIRCLE_PULL_REQUEST pr_url

Tips

  • when: on_success: This is the key directive — it ensures Alert24 only records successful deployments, not failed ones.
  • Contexts: Store ALERT24_API_KEY in a CircleCI context (e.g., alert24) shared across projects to use the same API key across multiple repos without duplicating the secret.
  • Pull request number: $CIRCLE_PULL_REQUEST gives the full PR URL. To extract just the number, use: PR_NUM=$(echo $CIRCLE_PULL_REQUEST | grep -o '[0-9]*$').