Loading published curriculum…

20 · Production engineering and architecture / LESSON 96 OF 102

CI pipelines and artifact promotion

CI should prove a clean checkout can build, test, and package without your IDE or private cache.

Before this lesson: Package and containerize

Understand the topic

Run unit and integration tests, inspect test counts, and retain reports when a build fails. Supply database containers and a known JDK in the worker environment. Keep deployment credentials outside pull-request jobs from untrusted code.

Build a versioned artifact from a known commit and promote that same artifact between environments. Record the commit and dependency inputs. A pipeline that skips tests to publish a package defeats the release gate it claims to provide.

EXAMPLE · SHELL

ci.sh

set -eu
java -version
./mvnw --batch-mode --no-transfer-progress clean verify
# Upload reports and the verified artifact in your CI provider.
# Deployment is a separate environment-authorized job.

What to expect

Run in a Linux CI worker with Java 21 and the container runtime required by integration tests. The shell exits on a failed verification command.

YOUR TURN

Put it into practice

  1. 01Create a CI job for a clean verify build.
  2. 02Push a deliberate failing test and confirm no release artifact is promoted.
  3. 03Verify: A passing run records its commit and a failing run retains diagnostic reports without deploying.

Pass a quiz or complete a lab to check today’s streak. Each lesson counts once per day, including when you review it later.

UNDER THE HOOD

Build the mental model

CI should prove a clean checkout can build, test, and package without your IDE or private cache.

  1. 01Run unit and integration tests, inspect test counts, and retain reports when a build fails. Supply database containers and a known JDK in the worker environment. Keep deployment credentials outside pull-request jobs from untrusted code.
  2. 02Build a versioned artifact from a known commit and promote that same artifact between environments. Record the commit and dependency inputs. A pipeline that skips tests to publish a package defeats the release gate it claims to provide.
  3. 03Trace the example: Run in a Linux CI worker with Java 21 and the container runtime required by integration tests. The shell exits on a failed verification command.

A mistake worth avoiding

The pipeline publishes even though integration tests fail.

DEBUGGING ROOM

Something broke. Where do you look?

The pipeline publishes even though integration tests fail.

Before revealing the diagnosis, write down your first investigation step.

CHECK YOUR UNDERSTANDING

Should production promotion rebuild different business code from the tested artifact?

Choose one answer

BUILD IT YOURSELF

Create a CI job for a clean verify build.

  1. 1.Create a CI job for a clean verify build.
  2. 2.Push a deliberate failing test and confirm no release artifact is promoted.
  3. 3.Reproduce this failure, then repair it: The pipeline publishes even though integration tests fail.

Acceptance checklist

Lab completion is your self-report. Knowledge checks do not certify project quality.

RETRIEVE IT FROM MEMORY

Should production promotion rebuild different business code from the tested artifact?

Revisit this lesson in three days after a successful check or lab.

Ready for the next step?

A passing run records its commit and a failing run retains diagnostic reports without deploying.

Reading is separate from passing a knowledge check or completing a lab.

Go deeper · official references