Sample diagrams: CI/CD, infrastructure and the software stack
The pipelines and architectures teams typically run, drawn as they are built and animated from the pull request to production, with the AI stations marked and the gates where a person decides. Press play.
Proves the stages: Release · Operate. Moved here from the test center, where the tests it runs still live.
How to read them
Four architectures, animated step by step
Four architectures teams run every day, drawn as they are typically built and animated step by step: the pull request that becomes a merge to main, the pipeline that takes main to production, the infrastructure it lands on, and the stack it runs. AI stations are marked and can be switched off to see the same pipeline without them. Every box links to the page of this center that goes deeper.
Press play, or step
Each diagram plays on its own when it scrolls into view and loops; Back and Next walk it one step at a time, the timeline under the caption jumps to any step, and the space bar and arrow keys work once the diagram has focus. Gates (amber) hold longer: that is where a person or a rule decides.
Switch the AI stations off
The AI stations (glowing purple, marked AI) are the places teams add an agent: review, triage, test generation, plan explanation, release notes, the incident summary. Untick the switch to see the same pipeline without them. Nothing else changes, which is the point: the stations add speed and drafts, and the gates stay where they were.
Typical, not invented
Every box is something teams run today, drawn as the documentation describes it, and the AI SDLC page's example project carries the files behind the two pipelines: the workflows, the Jenkinsfile, the deploy scripts. Download any diagram as SVG and put it in your own runbook.
Two triggers
The pull request starts the checks; the merge into main starts the deploy. Both pipelines are drawn that way, and the ruleset in between is the one from the AI SDLC page: required checks, code owners, signed commits, nothing merged by an agent.
Sample diagram
GitHub Actions: from pull request to production
The trigger is the pull request; the second trigger is the merge into main. Checks and the AI review run on the pull request, the ruleset decides the merge, and the push to main builds once, scans, deploys to staging through OIDC, waits for a person at the production environment, and goes out as a canary. Incidents close the loop with an AI-drafted summary and an agent-drafted fix that starts the whole thing again.
pipeline stageAI stationgate: a person or a rule decidespeopleinfrastructureincident or failure
Jenkins: a multibranch pipeline from pull request to production
The same story on a Jenkins controller with agents. GitHub sends the webhook, the multibranch project runs the Jenkinsfile for the pull request on an agent, parallel stages test it, a failing stage is triaged by an AI station from the post section, the merge triggers the main branch job, and an input step waits for a named submitter before production.
pipeline stageAI stationgate: a person or a rule decidespeopleinfrastructureincident or failure
Infrastructure: the IaC pipeline and what it builds
Infrastructure changes travel the same road as code: the ladder with no credentials, a plan with a read-only credential, an AI explanation of the plan for the reviewer, a person's approval, and an apply that is the only job with write access. Watch the cloud account fill in as the apply runs, a request cross it, and a change made by hand get caught by the drift check and put back into code.
pipeline stageAI stationgate: a person or a rule decidespeopleinfrastructureincident or failure
The software stack and the test that guards each layer
A request descends the stack of an AI-enabled application; then the tests fire, one kind per layer, with the AI station that helps write or grade each kind and the provenance gates that say who wrote what. Every test and agent here is on the Examples page with code that ran.
pipeline stageAI stationgate: a person or a rule decidespeopleinfrastructureincident or failure
The workflows and the Jenkinsfile the diagrams draw
From the example project, downloadable there as a whole. The GitHub workflows follow the documented syntax and the official Claude Code examples; the Jenkinsfile is written to the documented Declarative syntax and, since this site has no Jenkins, is the one file here that did not run.
.github/workflows/deploy.yml: the push to main (GitHub Actions diagram)
.github/workflows/deploy.yml
# The second trigger: the push to main. Build once, attest, scan, deploy to staging through OIDC,
# verify where variance is allowed, wait for a person at the production environment, go out as a
# canary, draft the release notes. The animated version is on the Sample diagrams page.
name: Deploy
on:
push:
branches: [main]
concurrency:
group: deploy-main
cancel-in-progress: false # a deploy in flight finishes; the next waits its turn
permissions:
contents: read
jobs:
build:
name: build once, attest
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
packages: write
id-token: write
attestations: write
outputs:
image: ${{ steps.meta.outputs.image }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- id: meta
run: echo "image=ghcr.io/${{ github.repository }}:${{ github.sha }}" >> "$GITHUB_OUTPUT"
- run: pip install build && python -m build
- name: Generate artifact attestation
uses: actions/attest@v4
with:
subject-path: 'dist/*'
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- run: docker build -t "${{ steps.meta.outputs.image }}" . && docker push "${{ steps.meta.outputs.image }}"
- uses: actions/upload-artifact@v5
with: { name: dist, path: dist/ }
scan:
name: scan
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- run: pip install checkov bandit
- run: bandit -q -r src
- run: checkov -d infra --framework terraform --quiet --compact --config-file infra/.checkov.yaml
staging:
name: deploy staging
needs: [build, scan]
runs-on: ubuntu-latest
timeout-minutes: 15
environment:
name: staging
url: https://staging.shop.example.test
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6
# the OIDC token is exchanged for a short-lived credential; no cloud key is stored in GitHub
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.STAGING_DEPLOY_ROLE }}
aws-region: ca-central-1
- run: ./deploy/deploy.sh staging "${{ needs.build.outputs.image }}"
verify:
name: verify in staging
needs: [build, staging]
runs-on: ubuntu-latest
timeout-minutes: 30
env:
BASE_URL: https://staging.shop.example.test
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with: { node-version: 22 }
- run: cd e2e && npm ci && npx playwright install --with-deps chromium && npx playwright test
- uses: grafana/setup-k6-action@v1
- run: k6 run load/smoke.js # thresholds in the script: p(95)<500, failures<1%
# the real model answers here; the pass rate, not zero failures, is the gate
- run: cd evals && PROMPTFOO_PASS_RATE_THRESHOLD=95 npx --yes promptfoo@latest eval --no-cache --repeat 5
production:
name: deploy production
needs: [build, verify]
runs-on: ubuntu-latest
timeout-minutes: 30
environment:
name: production # required reviewers and the wait timer are set on the environment
url: https://shop.example.test
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.PRODUCTION_DEPLOY_ROLE }}
aws-region: ca-central-1
- run: ./deploy/deploy.sh production "${{ needs.build.outputs.image }}" --canary 10
- run: ./deploy/smoke.sh production
- run: ./deploy/deploy.sh production "${{ needs.build.outputs.image }}" --all
notes:
name: release notes, drafted
needs: production
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: read
id-token: write
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: "Draft release notes for the commits on main since the last tag, grouped by area, one line each; a person will edit and publish them."
claude_args: |
--max-turns 5
--allowedTools "mcp__github__list_commits"
.github/workflows/ci.yml: the pull request (GitHub Actions diagram)
.github/workflows/ci.yml
# The gates every pull request passes before a person reads it: check, score, judge.
# Each job is a required status check in rulesets/main.json, so nothing merges without them.
name: CI
on:
pull_request:
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
name: lint, unit, property, API
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- run: pip install -e .[dev]
- run: ruff check . && ruff format --check .
- run: pytest --junitxml=results/junit-unit.xml
- uses: actions/upload-artifact@v5
if: always()
with: { name: junit-unit, path: results/ }
score:
name: mutation score
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- run: pip install -e .[dev]
- run: mutmut run
- run: python scripts/mutation_gate.py
env: { MUTATION_MIN_SCORE: "0.80" }
contract:
name: Schemathesis against the OpenAPI schema
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- run: pip install -e .[dev]
- run: |
uvicorn acme.app:app --port 8081 --app-dir src &
for i in $(seq 1 30); do curl -sf http://127.0.0.1:8081/openapi.json > /dev/null && break; sleep 1; done
- run: schemathesis run http://127.0.0.1:8081/openapi.json --max-examples 200 --continue-on-failure --report junit --report-dir results
- uses: actions/upload-artifact@v5
if: always()
with: { name: junit-contract, path: results/ }
e2e:
name: Playwright
runs-on: ubuntu-latest
timeout-minutes: 20
defaults: { run: { working-directory: e2e } }
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with: { node-version: 22 }
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npx playwright test
- uses: actions/upload-artifact@v5
if: always()
with: { name: playwright-results, path: e2e/results/ }
evals:
name: promptfoo evals
runs-on: ubuntu-latest
timeout-minutes: 10
defaults: { run: { working-directory: evals } }
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with: { node-version: 22 }
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
# the provider here is deterministic, so no model key is needed; a real bot reads its key
# from a GitHub Secret passed as env, never from the repository
- run: npx --yes promptfoo@latest eval --no-cache --output results.json
passports:
name: Test Passports
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- run: pip install pyyaml
- run: python scripts/passport_check.py tests --min-grade B
Jenkinsfile (Jenkins diagram)
Jenkinsfile
// The same pipeline on Jenkins, as drawn on the Sample diagrams page. Declarative syntax; in a
// real setup the stages come from the shared library (vars/) and this file is a few lines.
// Written to the documented syntax (jenkins.io/doc/book/pipeline/syntax); not run here.
@Library('acme-pipeline@v3') _
pipeline {
agent none // every stage names its own agent; nothing runs on the controller
options {
timeout(time: 45, unit: 'MINUTES')
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '30'))
}
environment {
IMAGE = "ghcr.io/acme/checkout:${env.GIT_COMMIT.take(12)}"
}
stages {
stage('Checkout') {
agent { label 'linux' }
steps { checkout scm; stash name: 'src', includes: '**/*' }
}
stage('Build') {
agent { label 'linux' }
steps { unstash 'src'; sh 'pip install -e .[dev] && python -m build'; stash name: 'dist', includes: 'dist/**' }
}
stage('Test') {
parallel {
stage('Unit and property') {
agent { label 'linux' }
steps { unstash 'src'; sh 'pytest --junitxml=results/junit.xml' }
post { always { junit 'results/junit.xml' } }
}
stage('Static analysis') {
agent { label 'linux' }
steps { unstash 'src'; sh 'ruff check . && ruff format --check . && bandit -q -r src' }
}
stage('AI test generation') {
agent { label 'linux' }
when { changeRequest() } // pull requests only
options { timeout(time: 10, unit: 'MINUTES') } // the budget
environment { ANTHROPIC_API_KEY = credentials('anthropic-api-key') }
steps {
unstash 'src'
// the agent proposes tests for the diff; mutation testing grades them; nothing is committed
sh 'claude -p "Write pytest tests for the files changed in this pull request, to docs/ and never to the implementation." --max-turns 15 --allowedTools "Read,Grep,Glob,Write"'
sh 'mutmut run && python scripts/mutation_gate.py'
sh 'git diff > results/ai-tests.patch'
archiveArtifacts artifacts: 'results/ai-tests.patch', allowEmptyArchive: true
}
}
}
}
stage('Package and image') {
agent { label 'linux' }
environment { REGISTRY = credentials('ghcr-push') } // REGISTRY_USR and REGISTRY_PSW
steps {
unstash 'src'; unstash 'dist'
sh 'echo "$REGISTRY_PSW" | docker login ghcr.io -u "$REGISTRY_USR" --password-stdin'
sh 'docker build -t "$IMAGE" . && docker push "$IMAGE"'
archiveArtifacts artifacts: 'dist/*', fingerprint: true
}
}
stage('Scan') {
agent { label 'linux' }
steps {
unstash 'src'
sh 'checkov -d infra --framework terraform --quiet --compact --config-file infra/.checkov.yaml'
sh 'trivy image --exit-code 1 --severity HIGH,CRITICAL "$IMAGE"'
}
}
stage('Deploy staging') {
when { branch 'main' }
agent { label 'deploy' }
environment { KUBECONFIG = credentials('kubeconfig-staging') }
steps { unstash 'src'; sh './deploy/deploy.sh staging "$IMAGE" --all' }
}
stage('Verify') {
when { branch 'main' }
parallel {
stage('End to end') {
agent { label 'linux' }
steps { unstash 'src'; sh 'cd e2e && npm ci && npx playwright install --with-deps chromium && BASE_URL=https://staging.shop.example.test npx playwright test' }
}
stage('Load') {
agent { label 'linux' }
steps { unstash 'src'; sh 'BASE_URL=https://staging.shop.example.test k6 run load/smoke.js' }
}
stage('Evals') {
agent { label 'linux' }
steps { unstash 'src'; sh 'cd evals && PROMPTFOO_PASS_RATE_THRESHOLD=95 npx --yes promptfoo@latest eval --no-cache --repeat 5' }
}
}
}
stage('Approve production') {
when { branch 'main' }
agent none
input {
message 'Deploy this build to production?'
ok 'Deploy'
submitter 'release-managers'
parameters { string(name: 'NOTES', defaultValue: '', description: 'Release notes, as reviewed') }
}
steps { echo "Approved. Notes: ${NOTES}" }
}
stage('Deploy production') {
when { branch 'main' }
agent { label 'deploy' }
environment { KUBECONFIG = credentials('kubeconfig-production') }
steps {
unstash 'src'
sh './deploy/deploy.sh production "$IMAGE" --canary 10'
sh './deploy/smoke.sh production'
sh './deploy/deploy.sh production "$IMAGE" --all'
}
}
}
post {
failure {
// the triage station: reads the console log and the JUnit report, comments on the pull request
script { node('linux') { unstash 'src'; sh 'python scripts/triage.py --build "$BUILD_URL" --junit results/' } }
}
success {
script { if (env.BRANCH_NAME == 'main') { node('linux') { unstash 'src'; sh 'python scripts/release_notes.py --draft' } } }
}
always { echo "${currentBuild.currentResult}: ${env.JOB_NAME} #${env.BUILD_NUMBER}" }
}
}
.github/workflows/iac.yml: the ladder per module (Infrastructure diagram)
.github/workflows/iac.yml
# Every pull request that touches infra/ climbs the ladder for each module, with no cloud
# credentials. The plan and apply jobs run on main through OIDC and a protected environment,
# never from a pull request and never from an agent's shell.
name: Infrastructure
on:
pull_request:
paths: ["infra/**"]
permissions:
contents: read
jobs:
ladder:
name: ${{ matrix.module }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
module: [infra/fixed/aws, infra/fixed/azure, infra/fixed/gcp]
steps:
- uses: actions/checkout@v6
- uses: opentofu/setup-opentofu@v1
- uses: terraform-linters/setup-tflint@v4
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- run: pip install checkov
- run: |
curl -fsSL https://github.com/open-policy-agent/conftest/releases/download/v0.71.1/conftest_0.71.1_Linux_x86_64.tar.gz | tar xz conftest
sudo mv conftest /usr/local/bin/
- run: tflint --init --config=infra/.tflint.hcl
env: { GITHUB_TOKEN: "${{ github.token }}" }
- run: infra/scripts/ladder.sh ${{ matrix.module }}
- run: checkov -d ${{ matrix.module }} --framework terraform -o sarif --output-file-path results --soft-fail
if: always()
- uses: github/codeql-action/upload-sarif@v4
if: always()
with: { sarif_file: results/results_sarif.sarif }
deploy/deploy.sh: the one script both pipelines call
deploy/deploy.sh
#!/usr/bin/env bash
# deploy.sh <environment> <image> [--canary N | --all]: the one script both pipelines call.
# What it does depends on the platform (a Kubernetes rollout, an ECS service update, a Helm
# release); what it never does is build. The image was built once and attested; this only moves it.
set -euo pipefail
ENV=${1:?environment}; IMAGE=${2:?image}; MODE=${3:---all}; WEIGHT=${4:-100}
echo "deploy $IMAGE to $ENV ($MODE $WEIGHT)"
case "$MODE" in
--canary) kubectl -n "$ENV" set image deployment/checkout-canary checkout="$IMAGE" && kubectl -n "$ENV" annotate --overwrite ingress checkout canary-weight="$WEIGHT" ;;
--all) kubectl -n "$ENV" set image deployment/checkout checkout="$IMAGE" && kubectl -n "$ENV" rollout status deployment/checkout --timeout=5m ;;
*) echo "unknown mode $MODE" >&2; exit 2 ;;
esac
The diagrams are ours; the facts in their captions come from the pages above and from this center's own pages, which every caption links to. The renderer is a few hundred lines of SVG and JavaScript in the repository, no library.