A CI/CD pipeline is the automated path a change takes from commit to a verified release. Each change is built, tested, scanned and packaged the same way, then deployed through gates that stop the line when a check fails, and the release counts only when production runs the build that passed.

Database and infrastructure changes can take the same path (infrastructure as code). Product details are as documented in October 2026.

What is the difference between CI, continuous delivery and continuous deployment?

The three terms nest: delivery builds on integration, and deployment builds on delivery. Martin Fowler defines continuous integration (CI) as each team member merging into the mainline at least daily, with every integration verified by an automated build, including tests. Testing a feature branch against the mainline without pushing back to it is what he calls semi-integration. A red build comes first: Fowler quotes Kent Beck, "nobody has a higher priority task than fixing the build".

PracticeWhat it meansWho presses release
Continuous integrationEveryone merges to the mainline at least daily, and each merge gets an automated build and testsNobody; it ends at a verified build
Continuous deliveryThe product is releasable to production whenever anyone wishesA person, on demand
Continuous deploymentThe product is released to production automatically whenever it passes all the automated tests in the pipelineThe pipeline

continuousdelivery.com describes the deployment pipeline: each change triggers a process that builds deployable packages and runs unit tests and static analysis in a commit stage that takes only a few minutes. Its practices include building packages only once, deploying the same way to every environment, development included, and smoke testing each deployment.

DORA says where to stop: continuous delivery applies to all kinds of software, but continuous deployment cannot be applied to software such as firmware or mobile apps, so start with delivery even if you never plan to deploy every change automatically.

What stages does a pipeline have, and what gates each one?

A stage answers one question, and a gate stops the line when the answer is no. Order stages by cost so the cheapest checks fail first. Fowler's example is two stages: unit tests with slow services replaced by test doubles, then slower tests on additional machines.

A conveyor carries grey boxes from a laptop through three arched gates that grow taller toward a server. At the first, smallest gate an orange barrier arm is lowered over a cracked box.
Fig. 1 The cheapest gate comes first, so failures there never reach the slow stages.
StageWhat runsThe gate
SourcePull request, review, merge to the mainlineA required check is red, or stuck "Pending" because a path filter skipped its workflow
BuildInstall from the lockfile, compileA compile error, or a lockfile that disagrees with package.json (npm ci exits with an error)
TestUnit, integration and end-to-end tests: many unit tests, far fewer high-level ones (the test pyramid)Any failing test, because "99.9% green is still red"
SecuritySecret scanning, static analysis (SAST, for example CodeQL), dependency audit, container and IaC scans (for example Trivy)A finding at or above the severity you set (npm audit exits non-zero)
PackageBuild the image once, push it, attach an SBOM and provenance, sign it (for example with Sigstore keyless signing) if others verify itA failed push or attestation
DeployStaging, then production through the same script, behind an approvalNo reviewer approves, or the rollout does not finish in time
VerifySmoke test, running-version check, monitoringProduction reports a different build than the one tested; roll back

What does a working GitHub Actions pipeline look like?

This workflow takes a Node.js service from pull request to a verified production deploy on Amazon EKS, with images in Amazon ECR. It is an illustration: the account ID, role names, cluster, host name and image name are placeholders, and the service must return its commit from /version. Actions are pinned to full commit SHAs as of October 2026, the file passes actionlint 1.7.12, and the Ubuntu 24.04 runner image includes kubectl, the AWS CLI, jq and curl.

# .github/workflows/ci-cd.yml
name: ci-cd

on:
  pull_request:
  push:
    branches: [main]

permissions: {}

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

env:
  IMAGE: 111122223333.dkr.ecr.us-east-1.amazonaws.com/shop-api

jobs:
  test:
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with:
          node-version-file: .nvmrc
          cache: npm
      - run: npm ci
      - run: npm audit --omit=dev --audit-level=high
      - run: npm test

  image:
    needs: test
    if: github.event_name == 'push'
    runs-on: ubuntu-24.04
    timeout-minutes: 20
    permissions:
      contents: read
      id-token: write # lets the job ask GitHub for an OIDC token
    outputs:
      digest: ${{ steps.build.outputs.digest }}
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
        with:
          role-to-assume: arn:aws:iam::111122223333:role/shop-api-image-push
          aws-region: us-east-1
      - uses: aws-actions/amazon-ecr-login@03f1aad4c6c7ffd436567f42f9384779290529bd # v2.1.7
      - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
      - id: build
        uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
        with:
          context: .
          push: true
          tags: ${{ env.IMAGE }}:${{ github.sha }}
          build-args: COMMIT_SHA=${{ github.sha }}
          provenance: mode=max
          sbom: true
          cache-from: type=gha
          cache-to: type=gha,mode=max

  deploy:
    needs: image
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    environment: production # required reviewers are set on the environment
    concurrency:
      group: deploy-production
      cancel-in-progress: false
    permissions:
      id-token: write
    steps:
      - uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
        with:
          role-to-assume: arn:aws:iam::111122223333:role/shop-api-deploy
          aws-region: us-east-1
      - run: aws eks update-kubeconfig --name shop-prod
      - env:
          IMAGE_REF: ${{ env.IMAGE }}@${{ needs.image.outputs.digest }}
        run: kubectl set image deployment/shop-api app="$IMAGE_REF"
      - id: rollout
        run: kubectl rollout status deployment/shop-api --timeout=300s
      - id: verify
        run: |
          for _ in $(seq 10); do
            running=$(curl -fsS https://shop.example.com/version | jq -r .commit) || true
            [ "$running" = "$GITHUB_SHA" ] && exit 0
            sleep 6
          done
          echo "production reports '${running:-nothing}', expected $GITHUB_SHA" >&2
          exit 1
      - if: failure() && (steps.rollout.outcome == 'failure' || steps.verify.outcome == 'failure')
        run: kubectl rollout undo deployment/shop-api

Tip

GitHub is moving ubuntu-latest to Ubuntu 26.04 in a rollout that starts on October 19, 2026 and is planned to finish by November 19. This workflow names ubuntu-24.04; test on ubuntu-26.04 before you move.

Least privilege and concurrency. permissions: {} at the top disables every token permission, and once you list any permission, GitHub sets the unlisted ones to none, so each job asks only for what it uses: contents: read to check out, and id-token: write on the two jobs that call AWS, a setting that "does not grant write access to other resources". The first concurrency group cancels superseded pull request runs but never a running deploy, and the deploy-production group stops production deploys from overlapping.

Build once, deploy the digest. The image job runs only after a merge, pushes the image tagged with the commit SHA and reports its digest, which the deploy job rolls out. A tag can be moved, while a digest is an immutable identifier, so production runs exactly the image the pipeline built. provenance: mode=max and sbom: true attach attestations to the pushed image. Max provenance exposes build argument values, so pass secrets as secret mounts, never build arguments.

The release we run for Minute Notary, an online notary platform with its head office in Ottawa, closes the gap between "pushed" and "live". The image carries its own release ID, the script reads the digest back from the registry after the push, and a deploy counts only when production reports that same ID. Database migrations must succeed before the new server starts, and the previous build's files stay served for a while, so a booking tab opened before the deploy keeps working and reloads once onto the new version. The case study covers the rest of its pipeline.

A laptop and a gear on the left build one sealed crate with an orange band, which rests on a warehouse shelf. Two dashed arrows lead from the shelf to a staging server and a production server.
Fig. 2 One image, built once and promoted by digest, so every environment runs the same bytes.

Approve, roll out, prove. environment: production pauses the deploy job until a required reviewer approves. On GitHub Free, Pro and Team, required reviewers are available only for public repositories, and administrators can bypass protection rules by default, so check both. kubectl rollout status waits up to 300 seconds, verify polls /version until production reports the commit that was built, and a failure in either runs kubectl rollout undo, which works because Kubernetes keeps 10 old ReplicaSets by default.

Not in the file: an OIDC identity provider, two IAM roles, an ECR repository, an EKS access entry for the deploy role, a shop-api Deployment with an app container, the environment's reviewers, and a Dockerfile that serves COMMIT_SHA at /version.

The same pipeline in GitLab CI

GitLab uses different keywords. This shortened version keeps a test job and a gated deploy that calls a deploy.sh you write:

stages: [test, deploy]

test:
  stage: test
  image: node:24
  script:
    - npm ci
    - npm test

deploy-production:
  stage: deploy
  environment: production
  resource_group: production
  id_tokens:
    AWS_ID_TOKEN:
      aud: sts.amazonaws.com
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual
  script:
    - ./deploy.sh

id_tokens with an aud replaces id-token: write. resource_group limits job concurrency, when: manual makes a person start the job, and deployment approvals add a formal gate on Premium or Ultimate.

How do you secure the pipeline itself?

A pipeline can hold the keys to production, and attackers have compromised actions that pipelines run. Aqua's advisory says that on March 19, 2026 an attacker used compromised credentials to publish a malicious Trivy v0.69.4 release and force-push 76 of 77 version tags in trivy-action to credential-stealing malware. In March 2025, CISA reported that tj-actions/changed-files (CVE-2025-30066) was compromised and could expose secrets such as access keys and npm tokens.

Pin third-party actions to a full commit SHA. GitHub calls this currently the only way to use an action as an immutable release, and says to check that the SHA belongs to the action's repository, not a fork. A pin is not a review: Aqua lists "SHA pinning to a safe commit" as unaffected, yet a trivy-action pin from before 2025-04-09 would pull a malicious setup-trivy if invoked during the exposure window. Dependabot opens pull requests for outdated actions and updates the version comment beside a SHA.

Replace stored cloud keys with OIDC. The cloud provider issues a short-lived token valid only for a single job, so no long-lived cloud credentials sit in GitHub secrets. On AWS, the role's trust policy checks the token's aud and sub claims. Be exact with sub: a StringLike match on repo:octo-org/octo-repo:* lets any branch, pull request merge branch or environment assume the role. For the deploy role, name the environment:

{
  "StringEquals": {
    "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
    "token.actions.githubusercontent.com:sub": "repo:ORG/REPO:environment:production"
  }
}

Repositories created after July 15, 2026, or that opt in, get a sub with immutable owner and repository IDs, so copy the format your repository uses. GitHub also recommends protection rules on any environment an OIDC policy names.

A pipeline runner on wheels stands beside an empty open safe. A stamping booth passes a plain ticket into a gatehouse window under a cloud, and one short orange key comes back to the runner.
Fig. 3 The runner holds no stored key: it trades an identity token for a credential that expires with the job.

Never run untrusted code beside your secrets. pull_request_target and workflow_run workflows are privileged, and checking out an untrusted pull request in them exposes the repository. actions/checkout v7, generally available on June 18, 2026, refuses to fetch fork pull request code in those events unless you set allow-unsafe-pr-checkout.

Warning

GitHub backported the refusal to supported older majors on July 20, 2026 (v1 excluded), but only workflows on a floating major tag such as @v4 pick it up, not SHA, minor or patch pins. It also does not cover issue_comment workflows, run steps that fetch a pull request head, or other untrusted repositories.

GitHub's default policy also blocks pull_request_target in public repositories without a policy of their own: evaluate mode until enforcement on November 2, 2026 for affected repositories. These controls sit around the code-level checks in our secure coding checklist.

Which deployment strategy fits, and how do you roll back?

Choose the rollback before the rollout. Fowler's note on continuous delivery lists push-button deployments of any version to any environment on demand, so a rollback can be an ordinary deploy of the last good version.

StrategyHow it worksRollbackWhat to watch
Rolling updateReplaces instances gradually; Kubernetes defaults to 25% max unavailable and 25% max surgekubectl rollout undo (--to-revision=N for an older one); needs revisionHistoryLimit above 0Old and new Pods run side by side during the rollout
Blue-greenTwo production environments, as identical as possible; switch the router to the new oneSwitch the router backTwo environments to run; the schema must work with both versions
CanaryThe new version reaches a small subset first, then widensRoute traffic away from itSeveral versions run at once; watch the slice's metrics before you widen it
Feature flagCode ships switched off; a flag releases itTurn the flag offRelease toggles "should generally not stick around much longer than a week or two"; flags come with a carrying cost

Argo Rollouts says a rolling update "provides no control over the blast radius" in large-scale, high-volume production, and adds blue-green and canary updates, metric analysis and automated rollbacks.

A cloud feeds a router above a row of five servers. Four servers receive thick grey arrows, and the fifth, the canary, receives a single thin orange arrow.
Fig. 4 A canary sends a thin slice of traffic to the new version, so rollback is a routing change.

Argo CD, a declarative GitOps continuous delivery tool for Kubernetes, rolls back to any configuration committed in Git and detects configuration drift automatically. Our OpenShift vs Kubernetes guide compares the pipeline and GitOps tooling each gives you.

How do database migrations fit into a pipeline?

Code rolls back with kubectl rollout undo; data does not. Run schema changes as their own step, and make each one work with the version before it and the version after it. The method is parallel change, also called expand and contract: split a backward-incompatible change into expand, migrate and contract phases. Fowler's blue-green note gives the order for schemas: first a change that supports both versions of the application, then the application upgrade, and the removal of old support later.

Three database tables in a row. The left gains an empty dashed column, the middle copies values into it with curved arrows and the new column is orange, and the right has lost the old column.
Fig. 5 The old column stays until no running version reads it, so releases can be rolled back while the data moves.

Renaming customers.name to full_name takes three phases (PostgreSQL syntax):

-- Expand: additive, so the running version is unaffected
ALTER TABLE customers ADD COLUMN full_name text;
-- deploy the app version that writes both columns

-- Migrate: backfill in batches until no rows match, then enforce
UPDATE customers SET full_name = name WHERE id BETWEEN 1 AND 10000 AND full_name IS NULL;
-- deploy the app version that reads full_name
ALTER TABLE customers ADD CONSTRAINT full_name_set CHECK (full_name IS NOT NULL) NOT VALID;
ALTER TABLE customers VALIDATE CONSTRAINT full_name_set;

-- Contract: only after no running version reads name
ALTER TABLE customers DROP COLUMN name;

Locks decide whether a step is safe on a busy table. The PostgreSQL 18 documentation says adding a column with no default or a non-volatile default needs no table rewrite, while a volatile default rewrites the table and its indexes. NOT VALID skips the scan, and VALIDATE CONSTRAINT takes only a SHARE UPDATE EXCLUSIVE lock, so concurrent updates continue. SET NOT NULL scans the table unless a valid CHECK constraint proves there are no nulls, and ALTER TABLE forms take an ACCESS EXCLUSIVE lock by default. CREATE INDEX CONCURRENTLY builds without blocking writes but cannot run in a transaction block.

The contract step is the one a redeploy cannot undo, so take a restore point first and choose its recovery targets (RTO vs RPO).

How do you keep the pipeline fast and its tests trusted?

Set a time budget and defend it: Fowler calls the Extreme Programming guideline of a ten minute build perfectly within reason for most projects. Then cache what is slow and safe to reuse. GitHub's cache removes entries not accessed for over 7 days, limits a repository to 10 GB by default and caps a key at 512 characters. Put the lockfile hash in the key, and a changed lockfile creates a new cache automatically. setup-node with cache: npm caches npm's global package data, not node_modules. Docker marks its type=gha layer cache experimental. Keep credentials out of cached paths, because anyone who can open a pull request can read the base branch's caches.

Flaky tests teach people to ignore red builds. Google reported in 2016 that about 1.5% of its test runs reported a flaky result, almost 16% of its tests showed some flakiness, and about 84% of observed pass-to-fail transitions involved a flaky test, so it was "quite common to ignore legitimate failures in flaky tests". Quarantine removes a test from the critical path but "could easily mask a real race condition". Fowler agrees that it helps at first but says you still have to fix the tests soon, and suggests a numeric or time limit on quarantine. Our automation testing trends guide covers the wider test strategy.

Which numbers show whether the pipeline works?

DORA's guide, last updated January 5, 2026, defines five metrics in two groups. Throughput: change lead time (from committed to deployed in production), deployment frequency and failed deployment recovery time. Instability: change fail rate and deployment rework rate, the ratio of deployments that are unplanned but happen because of an incident in production. DORA says speed and stability are not tradeoffs, and that the metrics suit one application or service at a time.

The data for these metrics is spread across several systems. DORA says integrations to multiple systems may not be worth the initial investment and suggests starting with conversations, the DORA Quick Check or a product with pre-built integrations. Its pitfalls include setting metrics as goals (Goodhart's law), relying on one metric, using the industry as a shield and comparing vastly different applications. Our software development process guide covers delivery beyond the pipeline.

Which failure modes break a pipeline, and what fixes each?

Each failure mode below leaves a visible symptom. Like any code, a pipeline also collects technical debt.

Failure modeSymptom and causeFix
Slow pipelineFeedback arrives late; the build is well past ten minutesCheapest checks first, cache by lockfile hash, slow suites later, and a timeout-minutes below the default of 360
Flaky tests ignoredRed builds are assumed flaky, and legitimate failures are ignoredQuarantine with an owner and a cap, and fix the cause soon
Secrets in logsA secret stored as a JSON or YAML blob may not be redacted; an untrusted pull request title is pasted into a scriptSingle-value secrets or OIDC; pass untrusted input through an intermediate environment variable
Manual steps in productionA script run by hand, or an administrator forcing a deployOne deploy script for every environment, and no administrator bypass
Green pipeline, broken releaseTests pass, but production runs another build or the rollout never finishedThe verify step and automatic rollback shown above

The fifth row is the one a green check hides: exit code 0 shows that a command ran, not what production runs.

A pipeline box sends a crate with a grey striped tag into a server. An arrow leads to a level scale holding that grey tag and the server's own orange tag, and an older crate waits on a shelf below.
Fig. 6 A deploy counts only when production reports the build that was tested; otherwise the older crate goes back in.

How do you move from manual deploys to a pipeline?

Finish each stage before the next; a stage is done when its check passes in front of the team.

  1. Baseline one service. Write down every manual release step, time one release, and note lead time, deployment frequency, recovery time and change fail rate. Done when one person owns the numbers.
  2. Build every pull request. Install from the lockfile, run the unit tests and make the check required. Done when a red build blocks merging and fixing it comes first.
  3. Merge small and often. Keep branches to hours, and hide unfinished work behind a flag you remove within a week or two. Done when branches rarely outlive a working day.
  4. Build once, deploy by digest. One image per merge, tagged with the commit SHA and deployed to staging by the script production will use. Done when staging runs only images the pipeline built.
  5. Gate and verify production. An environment with reviewers, OIDC roles, the verify and rollback steps, pinned actions and permissions that start at none. Done when you have rehearsed a rollback on purpose.
  6. Add security checks one at a time. Secret scanning, dependency audit, static analysis and a container scan, reporting first and then blocking at a severity threshold. Done when each gate has an owner and a threshold.
  7. Raise the ambition last. Add canary or blue-green releases where one bad release is expensive, and decide about continuous deployment at the end. If a legacy system blocks daily releases, the strangler fig pattern replaces it piece by piece.

Computese builds this chain in its custom software development work, where the same gates run on every change and a release counts only when production reports the build that was tested. In cloud transformation the deliver lane's CI builds, tests and scans, signs each image and produces an SBOM, and Argo CD syncs to the cluster and detects drift. The chain can run without internet access: in a bank's move from OpenShift 3 to 4, Jenkins, Argo CD, Kaniko, Nexus, SonarQube and Trivy ran inside an air gap.