CI/CD: Making Software Delivery Repeatable

Why manual deployments fail, CI versus continuous delivery and deployment, the Apex pipeline, what must stop a release, and building one artifact to promote everywhere.

  • Advanced
  • About 17 minutes
  • Includes an exercise and a knowledge check

Before you start What you will learn in this module

Apex has approved the platform for its first production rollout. User acceptance testing is done: payments are ingested, settlement files processed, exceptions investigated and every resolution audited. In the readiness meeting the customer asks what happens when the application fails mid-payment, how they will know settlement ingestion stopped, whether a release can go out without disrupting finance, how fast they recover from a database failure, who gets the alert, and what it will cost as volume grows. Then: We understand that the application works. Before we trust it with financial operations, show us how it behaves when things go wrong. That is production engineering. By the end of this module you will be able to:

  • Design a repeatable CI/CD pipeline and promote one artifact.
  • Provision reproducible infrastructure as code and detect drift.
  • Deploy Apex to AWS with a runtime justified by the workload.
  • Configure containers, health checks, graceful shutdown and secrets.
  • Plan capacity and scale without breaking correctness.
  • Measure performance with percentiles and realistic load tests.
  • Harden identity, network, encryption and audit controls.
  • Build logs, metrics, traces, SLOs and actionable alerts.
  • Run incidents with runbooks and blameless reviews.
  • Design and prove backup, restore and disaster recovery.
  • Release safely with canaries and expand-and-contract migrations.
  • Run a production readiness review and hand over with evidence.

This module at a glance

Lessons
12 lessons, taking the Apex platform into production
Practical work
An exercise in every lesson and a production capstone with failure drills
Assessment
A check in every lesson and a 12-question final assessment (target: 10 of 12)
Time
About 3 hours 55 minutes (234 minutes across 12 lessons), plus the capstone

The problem Manual deployments depend on memory

An engineer builds locally, runs a few tests, copies the artifact to a server, edits configuration and restarts. It works. Two weeks later a colleague does the same but forgets one environment variable; the application starts and settlement processing quietly fails. The code was fine. The process depended on individual memory. A production deployment must be repeatable.

TermMeansFor Apex
Continuous integrationEvery change is automatically built and tested when mergedYes, on every pull request
Continuous deliveryValidated software is always deployable, released through an approvalYes: automatic to test, approval for production
Continuous deploymentQualifying changes go to production with no manual approvalNot yet: financial releases need approval

The design The Apex pipeline

Four pipeline stages joined by arrows, with a red gate between each. Validate: checkout, security checks, compile, unit, integration, contract and frontend tests. Package: container image, vulnerability scan, publish with digest. Test environment: validate infrastructure, deploy, smoke tests. Production: approval, deploy, verify. Below, one artifact, apex-reconciliation 1.4.0 with an example digest, is promoted unchanged to test, staging and production, each with its own configuration.
One pipeline, four gates, one artifact promoted everywhere.

yamlA teaching pipeline (GitHub Actions)

name: apex-reconciliation-ci
on:
  pull_request:
    branches: [main]
  push:
    branches: [main]
permissions:
  contents: read
env:
  JAVA_VERSION: "17"   # the project baseline: the same Java 17 the Module 07 programs ran on
  IMAGE: apex-reconciliation
jobs:
  backend:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with: { distribution: temurin, java-version: "${{ env.JAVA_VERSION }}" }
      - run: ./mvnw --batch-mode verify        # unit, integration and contract tests
  frontend:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: "22" }
      - run: npm ci
      - run: npm test -- --run
      - run: npm run build
  image:
    needs: [backend, frontend]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write                          # short-lived AWS credentials through OIDC; no stored keys
    outputs:
      image: ${{ steps.push.outputs.image }}
    steps:
      - uses: actions/checkout@v4
      - uses: aws-actions/configure-aws-credentials@v4
        with: { role-to-assume: "${{ vars.AWS_CI_ROLE_ARN }}", aws-region: "${{ vars.AWS_REGION }}" }
      - id: ecr
        uses: aws-actions/amazon-ecr-login@v2
      - run: docker build -t "$IMAGE:${{ github.sha }}" .
      - uses: aquasecurity/trivy-action@0.28.0   # the release policy: fail on critical vulnerabilities
        with: { image-ref: "${{ env.IMAGE }}:${{ github.sha }}", severity: CRITICAL, exit-code: "1" }
      - id: push
        run: |
          REF="${{ steps.ecr.outputs.registry }}/$IMAGE:${{ github.sha }}"
          docker tag "$IMAGE:${{ github.sha }}" "$REF"
          docker push "$REF"
          # record the immutable digest; every later step deploys this, never a tag
          echo "image=$(docker inspect --format='{{index .RepoDigests 0}}' "$REF")" >> "$GITHUB_OUTPUT"
  deploy-staging:
    needs: image
    runs-on: ubuntu-latest
    environment: staging
    permissions: { contents: read, id-token: write }
    steps:
      - uses: actions/checkout@v4
      - uses: aws-actions/configure-aws-credentials@v4
        with: { role-to-assume: "${{ vars.AWS_DEPLOY_ROLE_ARN }}", aws-region: "${{ vars.AWS_REGION }}" }
      - run: ./deploy/ecs-deploy.sh staging "${{ needs.image.outputs.image }}"
      - run: ./deploy/smoke-test.sh staging
  deploy-production:
    needs: [image, deploy-staging]
    runs-on: ubuntu-latest
    environment: production                    # required reviewers approve before this job starts
    permissions: { contents: read, id-token: write }
    steps:
      - uses: actions/checkout@v4
      - uses: aws-actions/configure-aws-credentials@v4
        with: { role-to-assume: "${{ vars.AWS_DEPLOY_ROLE_ARN }}", aws-region: "${{ vars.AWS_REGION }}" }
      - run: ./deploy/ecs-deploy.sh production "${{ needs.image.outputs.image }}"
      - run: ./deploy/smoke-test.sh production

The pipeline runs end to end: test, build, scan the image and stop on a critical vulnerability, push it, record its digest, deploy that exact digest to staging with a smoke test, then to production only after required reviewers approve. Java 17 is the project baseline, the same version the Module 07 programs ran on, set once at the top so every job agrees. It is still a teaching example: a real pipeline pins every action to a commit SHA, scans dependencies too, and keeps the deploy scripts in the repository under review.

Quality gates What should stop a deployment

  • Compilation or a critical automated test fails.
  • A required API contract is broken.
  • A critical vulnerability violates the release policy.
  • The image cannot be reproduced or verified.
  • Infrastructure configuration is invalid.
  • A database migration is incompatible with the running version.
  • Smoke tests fail after deployment.

Not every warning should block a release. Agree severity thresholds and a documented exception process, so the team neither ignores real findings nor drowns in noise.

Practice Build the CI pipeline

Practical exercise

Exercise 01: a working pipeline definition

Create the Apex pipeline and show one successful run.

  1. Compile Spring Boot and run the backend tests.
  2. Build React and run the frontend tests.
  3. Package a container image and publish it after the checks pass.
  4. Record the image digest.
  5. Block production deployment when a mandatory check fails.
Show a sample release record
  • Version: apex-reconciliation 1.4.0, digest recorded by the pipeline.
  • Checks: 412 unit, 61 integration and 18 contract tests passed; no critical vulnerabilities.
  • Promotion: test, then staging, then production after approval by the release owner.

3 questions

Check your understanding

1. Does successful compilation prove production readiness?
2. Why promote the same artifact between environments?
3. Continuous delivery versus continuous deployment?
Answer every question to submit.

What you can do now

  • Design a pipeline with meaningful quality gates.
  • Explain CI, continuous delivery and continuous deployment.
  • Promote one immutable artifact by digest.