Skip to the content

DocumentationDeployments

Connect your systems

Deployments

Reporting deployments and verifying fixes

When a deployment carries a fix, OpsCommand moves the incident on. The organisation's CI (or DeployPro) reports each deployment with the service's ingest key (the same key as for events, 4.5):

POST /v1/ingest/deployments
Authorization: Bearer oik_…
Content-Type: application/json

{
  "environment": "production",            // production, staging, test, development, other
  "outcome": "succeeded",                 // started, succeeded, failed, rolled_back
  "version": "2.4.2",
  "source": "GitHub Actions",
  "url": "https://github.com/acme/market/actions/runs/123",
  "commits": ["<sha>", "…"],              // the commits it carries
  "changes": [{ "kind": "pull_request", "repository": "acme/market", "number": 12 }],
  "handovers": ["HO-12"]                  // references found in its commit messages
}

OpsCommand answers 201 {"id": …, "matched": n, "moved": m}:

  • matched: handovers whose linked commits, pull requests or merge requests (5.4, 5.5) it carried, or which it named.
  • moved: incidents it moved on. When a deployment to production succeeds, each matched handover's incident in Fix in progress moves to Resolved, awaiting verification. If no resolution was written, the deployment becomes the resolution. No person is recorded as having resolved it, so whoever verifies it (5.7) is never "the same person".

Every matched incident's timeline records the deployment (environment, outcome, version, source, link), whatever its outcome. A failed or rolled-back deployment moves nothing.

From GitHub Actions

- name: Tell OpsCommand
  if: always()
  env:
    OPSCOMMAND_INGEST_KEY: ${{ secrets.OPSCOMMAND_INGEST_KEY }}
  run: |
    commits=$(git log --format=%H ${{ github.event.before }}..${{ github.sha }} | jq -R . | jq -sc .)
    refs=$(git log --format=%B ${{ github.event.before }}..${{ github.sha }} | grep -oiE 'HO-[0-9]+' | sort -u | jq -R . | jq -sc .)
    curl -sf https://api.opscommand.dev/v1/ingest/deployments \
      -H "Authorization: Bearer $OPSCOMMAND_INGEST_KEY" -H 'Content-Type: application/json' \
      -d "{\"environment\":\"production\",\"outcome\":\"${{ job.status == 'success' && 'succeeded' || 'failed' }}\",
           \"version\":\"${{ github.sha }}\",\"source\":\"GitHub Actions\",
           \"url\":\"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\",
           \"commits\":$commits,\"handovers\":$refs}"

From GitLab CI

opscommand:
  stage: .post
  when: always
  script:
    - commits=$(git log --format=%H "$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA" | jq -R . | jq -sc .)
    - outcome=$([ "$CI_JOB_STATUS" = "success" ] && echo succeeded || echo failed)
    - >
      curl -sf https://api.opscommand.dev/v1/ingest/deployments
      -H "Authorization: Bearer $OPSCOMMAND_INGEST_KEY" -H 'Content-Type: application/json'
      -d "{\"environment\":\"production\",\"outcome\":\"$outcome\",\"version\":\"$CI_COMMIT_SHORT_SHA\",
           \"source\":\"GitLab CI\",\"url\":\"$CI_PIPELINE_URL\",\"commits\":$commits}"

From DeployPro

DeployPro already reports failures and alerts through the ingest key (docs/connect/deploypro.patch, 4.12). To report deployments, DeployPro sends the same request when a production deploy finishes, with the commits it shipped. This is the next change to that patch, made in DeployPro's own repository with the owner's approval, like the patch itself.