teluzia.Cloud Engineer · Day 158
CHAPTER 23 · FLAGSHIP CAPSTONE

CI/CD integration

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Pipeline gates is today's starting point. Checkout succeeds, unit tests fail, and deployment must be skipped. Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction. You will connect this with deployment identity and rollback and provenance. The lesson's artifact brings these decisions together: Draft a CI workflow with test/build/deploy stages and a release evidence table; simulate a failed test and verify deployment is skipped.

Think of it this way

CI/CD is an assembly line with inspection gates and serial numbers; rejected work must not quietly proceed to shipping.

TOPIC 01 / 03Step by step

Pipeline gates

A pipeline builds, tests and publishes a versioned artifact before deployment. Each gate should reject a concrete failure; avoid deploying untested changes merely because checkout succeeded. Checkout succeeds, unit tests fail, and deployment must be skipped. Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction.

WORKED EXAMPLE
Checkout succeeds, unit tests fail, and deployment must be skipped. Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction.

A gate rejects work that fails a required check; an artifact is the immutable release output; provenance records the source and process producing it. Imagine unit tests pass but the Docker build uses a different dependency file. The test evidence may not describe the released image, so make build inputs explicit and test the relevant artifact where appropriate. Order checkout, dependencies, tests, build and publish with clear failure propagation. Record skipped stages separately from successful ones. Caching improves speed but can reuse stale inputs if keys omit important dependencies. A pipeline should produce one identifiable artifact and hand it to deployment, not rebuild differently in each environment. Review the workflow's failure paths so no conditional expression silently deploys when a required check has failed.

Why this matters

Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction.

A common trap

A successful checkout is sufficient approval to deploy.

MAKE IT VISIBLE

Rehearse a release decision

A RELEASE IS A SERIES OF DECISIONS

Can you ship without losing the old version?

This browser simulation shows why tests, plan review, health validation and rollback belong in a pipeline.

1Tests
2Plan review
3Deploy
4Health check
Currently serving: v1

Ready to run

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Pipeline gates

A pipeline builds, tests and publishes a versioned artifact before deployment. Each gate should reject a concrete failure; avoid deploying untested changes merely because checkout succeeded. Checkout succeeds, unit tests fail, and deployment must be skipped. Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction.

WORKED EXAMPLE
Checkout succeeds, unit tests fail, and deployment must be skipped. Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction.

A gate rejects work that fails a required check; an artifact is the immutable release output; provenance records the source and process producing it. Imagine unit tests pass but the Docker build uses a different dependency file. The test evidence may not describe the released image, so make build inputs explicit and test the relevant artifact where appropriate. Order checkout, dependencies, tests, build and publish with clear failure propagation. Record skipped stages separately from successful ones. Caching improves speed but can reuse stale inputs if keys omit important dependencies. A pipeline should produce one identifiable artifact and hand it to deployment, not rebuild differently in each environment. Review the workflow's failure paths so no conditional expression silently deploys when a required check has failed.

Why this matters

Build and publish a versioned artifact only through the intended gates; preserve the failed test output for correction.

A common trap

A successful checkout is sufficient approval to deploy.

Deployment identity

Use narrowly scoped workload credentials and protected environments. Prefer short-lived identity where available; ensure untrusted pull requests cannot access deployment secrets or production permissions. A trusted branch uses a narrowly scoped short-lived deployment role. An untrusted pull request may run tests without receiving that role, so code review cannot become a credential-exfiltration path.

WORKED EXAMPLE
A trusted branch uses a narrowly scoped short-lived deployment role. An untrusted pull request may run tests without receiving that role, so code review cannot become a credential-exfiltration path.

A trust boundary separates authorized workflow contexts; a workload identity authorizes automation; an environment approval or restriction controls sensitive deployment execution. Imagine a forked pull request edits the workflow to print a secret. Tests for that contribution must not receive the production deployment identity. Separate untrusted validation from trusted release jobs and limit role actions and resources to the capstone target. Short-lived credentials reduce persistent-secret handling but still require correct trust-policy conditions. Protection can slow releases, yet unrestricted automation creates a path from repository input to infrastructure control. Test the expected branch and actor conditions in a safe context, then document who can release, which checks must pass and what evidence identifies the automation that changed the service. Verify the denied workflow path separately.

Why this matters

An untrusted pull request may run tests without receiving that role, so code review cannot become a credential-exfiltration path.

A common trap

Any pull request should receive unrestricted deployment credentials.

Rollback and provenance

Connect commit, build run, artifact digest and deployment revision. A rollback needs a known good artifact and compatible data changes; rebuilding an old tag may not reproduce it. Record commit c17, build run 84 and digest sha256:abc as one release. Rollback uses the known-good digest and checks database compatibility rather than blindly rebuilding an old tag.

WORKED EXAMPLE
Record commit c17, build run 84 and digest sha256:abc as one release. Rollback uses the known-good digest and checks database compatibility rather than blindly rebuilding an old tag.

A release record joins commit, run and digest; a deployment revision describes the target version; rollback restores a previously verified compatible state. Imagine the image is safe to revert but its deployment introduced a one-way schema migration. Selecting an old digest alone may not restore functioning service. Plan compatibility and migration sequencing before release, and retain the prior configuration as well as the artifact identifier. Confirm the running service actually uses the chosen digest and that requests succeed after transition. Provenance makes diagnosis and rollback precise, while retaining artifacts and deployment history has storage and governance cost. Keep enough authorized evidence to reconstruct the release, and define a forward-fix alternative when rollback cannot safely undo the data or external effects already produced.

Why this matters

Rollback uses the known-good digest and checks database compatibility rather than blindly rebuilding an old tag.

A common trap

Rebuilding an old tag always recreates its former bytes.

KEEP THESE WITH YOU

Today’s takeaways

Pipeline gates: A pipeline builds, tests and publishes a versioned artifact before deployment.

Deployment identity: Use narrowly scoped workload credentials and protected environments.

Rollback and provenance: Connect commit, build run, artifact digest and deployment revision.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed