TheAgentHealth

← All documentation

CI deployment gates

Use a trusted deployment configuration with an exact-version, verified CLI. Replace the placeholder HTTPS readiness endpoint in agenthealth.yaml with your deployed service. It uses passive checks; explicitly select safe functional checks only when required.

  • GitHub Actions: verified install, reusable local Action and report artifact.
  • GitLab: JUnit report even on failure.
  • Jenkins: JUnit plugin, timeout and failure retention.
  • Azure DevOps: publish reports with always().
  • Shell: sh examples/ci/gate.sh configuration.yaml report.xml.

The non-GitHub examples assume the CLI was installed and verified before the job, using the installer or the installation guide. They are templates, not claims of testing against hosted GitLab/Jenkins/Azure services.

Exit codes 1–5 stop promotion; 6 means the tool failed and a complete report may not exist. Keep reports on failure, restrict artifact access and expiry, and never use || true on the gate. Configure runner/job deadlines above the configuration budget. See the guide for evidence mapping, credential boundaries, Kubernetes validation and GitHub Action inputs.

Configuration files

agenthealth.yaml

version: v1
targets:
  - name: deployment-readiness
    type: http
    endpoint: https://example.com/health
    budget_ms: 30000
    checks: [reachability, protocol]

github.yml

name: Validate deployment
on: workflow_dispatch
permissions:
  contents: read
  attestations: read
jobs:
  gate:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
      # This example runs from the AgentHealth source checkout. In an application
      # repository, vendor the installer at a reviewed immutable source commit.
      - name: Install verified release
        env:
          GH_TOKEN: ${{ github.token }}
        run: python scripts/install_ci_binary.py v0.22.1 "$RUNNER_TEMP/agenthealth"
      - uses: ./integrations/github-action
        with:
          binary: ${{ runner.temp }}/agenthealth
          version: v0.22.1
          configuration: examples/ci/agenthealth.yaml
          report: agenthealth-junit.xml
      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        if: always()
        with:
          name: agenthealth-junit
          path: agenthealth-junit.xml
          if-no-files-found: warn
          retention-days: 7

gitlab.yml

# Requires a runner with an exact-version, verified CLI installed.
agenthealth:
  stage: test
  timeout: 5 minutes
  script:
    - sh examples/ci/gate.sh examples/ci/agenthealth.yaml
  artifacts:
    when: always
    expire_in: 7 days
    reports:
      junit: agenthealth-junit.xml

Jenkinsfile

// Requires an exact-version verified CLI and the JUnit plugin on this agent.
pipeline {
  agent any
  options { timeout(time: 5, unit: 'MINUTES') }
  stages {
    stage('Deployment health') {
      steps { sh 'sh examples/ci/gate.sh examples/ci/agenthealth.yaml' }
      post { always { junit allowEmptyResults: true, testResults: 'agenthealth-junit.xml' } }
    }
  }
}

azure-pipelines.yml

# Requires a runner with an exact-version verified CLI installed.
steps:
  - bash: sh examples/ci/gate.sh examples/ci/agenthealth.yaml
    displayName: Deployment health gate
    timeoutInMinutes: 5
  - task: PublishTestResults@2
    condition: always()
    inputs:
      testResultsFormat: JUnit
      testResultsFiles: agenthealth-junit.xml
      failTaskOnFailedTests: true
      failTaskOnMissingResultsFile: true

gate.sh

#!/usr/bin/env sh
# Use an exact-version, provenance-verified CLI already on PATH.
# Preserve every health failure and code 6; do not pipe through tee.
set -eu
configuration=${1:?Usage: gate.sh configuration.yaml [report.xml]}
report=${2:-agenthealth-junit.xml}
if [ "$configuration" = "$report" ] || [ "$configuration" -ef "$report" ]; then
  echo 'AgentHealth report must not overwrite configuration' >&2
  exit 6
fi
if [ -L "$report" ]; then
  echo 'AgentHealth report must not be a symlink' >&2
  exit 6
fi
exec agenthealth check "$configuration" --format junit > "$report"