123DevOps··12 min read

How to improve your CI/CD (and how to do it): measure, diagnose, and evolve across 5 dimensions

A practical roadmap for improving your CI/CD: measure with the DORA metrics using GitHub and Azure DevOps data, find where the time and the failures go, and evolve speed, reliability, security, maintainability, and developer experience.

CI/CD

Almost every pipeline is born simple and ages badly. One job becomes ten, someone adds a sleep 30 “just for now,” the flaky tests get a re-run button, and the cloud key pasted in as a secret back in 2022 is still there.

Improving this doesn’t start with switching tools. It starts with measuring, then diagnosing where the time and the failures are, and only then tackling five dimensions: speed, reliability, security, maintainability, and developer experience.

Start by measuring: the DORA metrics

The DORA research program currently defines five software delivery metrics, split into two groups. The dora.dev metrics guide was updated in January 2026, and the newest metric is the deployment rework rate:

Group Metric What it measures
Throughput Change lead time From commit to running in production
Throughput Deployment frequency How often you ship to production
Throughput Failed deployment recovery time How long it takes to recover from a deployment that went wrong
Instability Change fail rate Deployments that need immediate intervention (rollback, hotfix)
Instability Deployment rework rate (new) Unplanned deployments triggered by a production incident

The most recent annual report, from 2025, changed its name: it is no longer the Accelerate State of DevOps and is now called State of AI-assisted Software Development. Its central message is that AI is an amplifier of what already exists: without controls such as automated testing, AI adoption tends to reduce delivery stability.

Collecting them from GitHub and Azure DevOps data

You don’t need a metrics platform to get started. The data is already in your CI provider. The idea is simple: a production deployment is a successful run of the deploy workflow on the main branch.

# Deployment frequency: successful deployments on main since November 1
gh run list --workflow deploy.yml --branch main --status success \
  --created ">=2026-11-01" --limit 500 --json databaseId --jq 'length'

# Lead time: SHA and finish time of each deployment...
gh run list --workflow deploy.yml --branch main --status success --limit 50 \
  --json headSha,updatedAt --jq '.[] | "\(.headSha) \(.updatedAt)"'
# ...compared with the commit date
gh api "repos/{owner}/{repo}/commits/<sha>" --jq '.commit.committer.date'

# Failures and recovery: incidents tracked as labeled issues
gh issue list --label incident --state closed --limit 100 \
  --json number,createdAt,closedAt

# Azure DevOps: the same information for the deploy pipeline
az pipelines runs list --pipeline-ids 12 --branch refs/heads/main \
  --result succeeded --top 200 \
  --query "[].{start:startTime, finish:finishTime, commit:sourceVersion}" -o table

Two rules keep the numbers honest. First, tag the deployments that went wrong: a rollback, hotfix, or incident has to point to the deployment that caused it. Without that, there is no change fail rate and no rework rate. Second, watch the trend: compare your team with itself, not with another company.

Diagnosis: where the time and the failures go

With a baseline in hand, open the pipeline and answer three questions:

  1. Where is the time? Separate queue time (waiting for a runner or an approval) from execution time. With gh run view <id> --json jobs you see when each job started and finished and find the critical path: the slowest job is what sets the total duration.
  2. Why does it fail? Sort the failures from the last few weeks into four groups: real code issues, flaky tests, infrastructure (runner, network, registry), and pipeline configuration. A gh run list --status failure already gives you the list.
  3. How much is re-runs? Runs with an attempt greater than 1 are a portrait of distrust in the pipeline.

The answer almost always clusters in a few spots: tests running serially, two or three flaky tests, and a step with no timeout.

The 5 dimensions of improvement

1. Speed

This topic already has two dedicated posts: the 7 techniques to cut pipeline time in half and the from 40 to under 10 minutes roadmap. Start with the critical path your diagnosis revealed.

2. Reliability

A reliable pipeline is one where red means a problem in the code.

  • Flaky tests go into quarantine: detect tests that fail and pass on the same commit, move them to a suite that runs but doesn’t block, with an owner and a deadline. Quarantine without a deadline is just a polite way of deleting the test.
  • Retries only for infrastructure: automatically retrying a download, a registry push, or a network call is reasonable. Retrying a failed test hides bugs.
  • Deterministic builds: install from the lockfile (npm ci, not npm install), pin base image and tool versions, and don’t rely on latest. The same commit has to produce the same artifact.
  • Timeouts on every job: a stuck job shouldn’t burn hours of runner time.

3. Security

The pipeline has access to the code, the secrets, and production. That makes it a target, and the Trivy case in March 2026 showed why: using stolen credentials, attackers rewrote 76 of the 77 tags of aquasecurity/trivy-action to point to code that stole secrets. Anyone pinning the action by tag ran the malicious code without changing a single line.

  • Pin actions to the full commit SHA, checking that it comes from the official repository and not from a fork. Tags can be moved; SHAs can’t. Dependabot (package-ecosystem: github-actions) keeps the SHAs up to date. Admins can enforce SHA pinning through policy, and GitHub also documents a workflow dependency lockfile (gh actions-lock); check the current docs for the status of that feature.
  • Least-privilege GITHUB_TOKEN: contents: read at the top of the workflow and extra permissions only on the job that needs them.
  • OIDC instead of long-lived secrets: the job exchanges a short-lived token, valid only for that run, for temporary credentials on AWS, Azure, or GCP. There is no key to leak or rotate.
  • Provenance: generate attestations for what was built (actions/attest, with id-token: write and attestations: write) and verify them with gh attestation verify. The step-by-step is in the post on Cosign, SBOMs, and SLSA.
  • Security checks in the flow: SCA, SAST, and secret scanning, calibrated so they don’t turn into noise. See what DevSecOps is, the guide to SCA, SAST, and DAST, and silent DevSecOps.

4. Maintainability

  • Reusable workflows and templates: on GitHub, workflow_call; on Azure DevOps, templates with extends. Teams consume them, the platform team maintains them.
  • A single source of truth: tool versions, security rules, and mandatory steps live in the templates repository, versioned and reviewed.
  • Enforce their use: on Azure DevOps, the Required template check prevents a pipeline from deploying to an environment without extending the approved template. On GitHub, rulesets can require status checks before merging.
  • Environments: approvals, secrets, and branch rules per environment, instead of conditionals scattered across the YAML.

5. Developer experience

  • Fast feedback on PRs: lint, build, and unit tests in a few minutes. Heavy suites can run after the merge or in parallel.
  • Clear failure messages: publish test and security results as annotations on the line of code and write a job summary to $GITHUB_STEP_SUMMARY. “Exit code 1” is not a message.
  • Self-service: a new service with a ready-made pipeline should be a template, not a ticket.

Before and after in GitHub Actions

A typical “before” workflow: actions by branch, default permissions, a static AWS key, and a deployment that also fires on PRs.

# BEFORE: .github/workflows/ci.yml
name: ci
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
      - uses: actions/setup-node@main
      - run: npm install
      - run: npm test
      - run: npm run build
      - name: Deploy
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        run: aws s3 sync dist/ s3://example-site --delete

The “after,” with minimal permissions, SHA pinning, cancellation of stale runs, caching, a shard matrix, an environment, an attestation, and an OIDC login:

# AFTER: .github/workflows/ci.yml
name: ci
on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read                    # minimum for every job

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    strategy:
      fail-fast: false
      matrix:
        shard: [1, 2, 3]
    steps:
      - uses: actions/checkout@<full-sha>          # vX.Y.Z
      - uses: actions/setup-node@<full-sha>        # vX.Y.Z
        with:
          node-version: 24
          cache: npm                    # caches ~/.npm keyed on the lockfile
      - run: npm ci
      - run: npm test -- --shard=${{ matrix.shard }}/3

  deploy:
    needs: test
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    timeout-minutes: 15
    environment: production             # approvals and rules live in the environment
    permissions:
      contents: read
      id-token: write                   # OIDC: short-lived token
      attestations: write               # provenance attestation
    steps:
      - uses: actions/checkout@<full-sha>          # vX.Y.Z
      - uses: actions/setup-node@<full-sha>        # vX.Y.Z
        with:
          node-version: 24
          cache: npm
      - run: npm ci && npm run build && tar -czf site.tgz dist/
      - uses: actions/attest@<full-sha>            # v4
        with:
          subject-path: site.tgz
      - uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
        with:
          role-to-assume: arn:aws:iam::123456789012:role/deploy-site
          role-session-name: deploy-${{ github.run_id }}
          aws-region: us-east-1
      - run: aws s3 sync dist/ s3://example-site --delete

A few details that make a difference:

  • <full-sha> marks where the 40-character SHA of the version you audited goes. The configure-aws-credentials SHA is the one from the OIDC example in GitHub’s docs; check the current version before using it.
  • cancel-in-progress only applies to PRs: canceling a main deployment halfway through is worse than waiting.
  • The AWS role should trust only the right repository and environment, through the token’s sub claim. Repositories created on or after July 15, 2026 use an immutable format for this claim that includes the owner and repository IDs; check the current docs when writing the trust policy.

The same in Azure Pipelines

On Azure DevOps, the same ideas become a central template and a lean pipeline in the application. The template:

# templates/node-ci.yml — platform/pipeline-templates repository
parameters:
  - name: azureServiceConnection
    type: string
  - name: storageAccount
    type: string

stages:
  - stage: test
    jobs:
      - job: test
        timeoutInMinutes: 15
        pool:
          vmImage: ubuntu-latest
        variables:
          npm_config_cache: $(Pipeline.Workspace)/.npm
        strategy:
          matrix:
            shard1: { SHARD: '1/3' }
            shard2: { SHARD: '2/3' }
            shard3: { SHARD: '3/3' }
        steps:
          - task: Cache@2
            inputs:
              key: 'npm | "$(Agent.OS)" | package-lock.json'
              path: $(npm_config_cache)
          - script: npm ci
          - script: npm test -- --shard=$(SHARD)

  - stage: deploy
    dependsOn: test
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
    jobs:
      - deployment: deploy
        timeoutInMinutes: 15
        pool:
          vmImage: ubuntu-latest
        environment: production         # approvals and checks live in the environment
        strategy:
          runOnce:
            deploy:
              steps:
                - checkout: self
                - script: npm ci && npm run build
                - task: AzureCLI@2      # service connection with workload identity federation (OIDC)
                  inputs:
                    azureSubscription: ${{ parameters.azureServiceConnection }}
                    scriptType: bash
                    scriptLocation: inlineScript
                    inlineScript: >-
                      az storage blob upload-batch
                      --account-name ${{ parameters.storageAccount }}
                      --destination '$web' --source dist
                      --auth-mode login --overwrite

And the application pipeline, which only extends the template:

# azure-pipelines.yml — application repository
trigger:
  batch: true                           # batches pushes while a run is in progress
  branches:
    include: [main]
pr:
  autoCancel: true                      # a new push to the PR cancels the previous run
  branches:
    include: [main]

lockBehavior: runLatest                 # together with the "Exclusive lock" check on the environment

resources:
  repositories:
    - repository: templates
      type: git
      name: platform/pipeline-templates
      ref: refs/tags/v1.4.0              # pinned template version

extends:
  template: templates/node-ci.yml@templates
  parameters:
    azureServiceConnection: sc-production-oidc
    storageAccount: stexamplesite

The service connection uses workload identity federation, the equivalent of OIDC: no service principal secret stored anywhere. Protect the tags in the templates repository and enable the Required template check on the production environment. Tasks and their inputs change over time; check the current docs.

Prioritized backlog: effort vs. impact

Improvement Dimension Effort Impact Priority
permissions: contents: read at the top of every workflow Security Low High 1
Pin actions by SHA + Dependabot for actions Security Low High 1
concurrency with cancellation on PRs and timeouts on every job Speed Low Medium 1
Collect DORA metrics with gh/az Measurement Low High 1
Dependency caching Speed Low Medium 2
OIDC instead of static cloud keys Security Medium High 2
Quarantine flaky tests with an owner and a deadline Reliability Medium High 2
Sharded tests (matrix) Speed Medium Medium 3
Reusable workflows / templates with extends Maintainability Medium High 3
Provenance attestations and verification at deploy time Security Medium Medium 4
Self-service templates for new services Experience High High 4

Start with the low-effort, high-impact rows and measure again after each block: if the DORA metrics don’t move, the improvement was cosmetic. The OWASP Top 10 categories help prioritize what the security checks should catch. And the work doesn’t end at deploy time: see what to do after deploy.

Checklist

  • DORA metrics collected and a baseline recorded
  • Pipeline critical path and failure causes identified
  • GITHUB_TOKEN with contents: read by default and per-job permissions
  • Actions pinned to full SHAs and updated by Dependabot
  • Cloud credentials via OIDC or workload identity federation
  • Flaky tests quarantined with an owner and a deadline; retries only for infrastructure
  • Central templates with extends or workflow_call and environments with checks

A good pipeline isn’t one that never fails. It’s one that fails for the right reason, fast, and says clearly what to do next.

Get updates on new posts and stay in the loop!