liveBook · Manning

Trunk-based development

As explained in Platform Engineering on Kubernetes

Trunk-based development is a source-control practice in which the main branch remains continuously releasable through small, validated changes and short-lived feature branches.

Trunk-based development keeps the main branch continuously releasable. Developers use short-lived feature branches, validate changes before merging, and avoid introducing changes that break the main branch’s build or release process. section 3.3

A trunk-based workflow connects branch validation to release automation:

  • Run a pipeline for each feature branch or pull request to verify that the changes build, test, and can be released against the main branch. section 3.4.1
  • Run the service pipeline after changes merge to main, producing artifacts from the latest code base. section 3.4.1
  • Treat a failing main-branch pipeline as an urgent problem; teams should focus on restoring the releasable state instead of merging more breakage. section 3.4.1
  • Create a Git tag for a release so the resulting artifact can be traced to the specific main-branch commit that produced it. section 3.4.1 section 3.4

A merge-to-release flow

A developer completes and tests a feature on a feature branch, opens a pull request, and waits for its validation pipeline. After review and a successful check, the change merges into main. The main-branch pipeline builds and tests the service, publishes binary artifacts, builds the container image, and can produce a tagged release. Each successful merge therefore supplies a tested, traceable release candidate. section 3.4.1 section 3.4

Figure 3.4 Service pipelines for main branch and feature branches

Use the pipeline diagram to compare validation on feature branches with release-producing execution on the main branch. section 3.4.1

How Platform Engineering on Kubernetes covers it

How deep it goes
Defines branch and pipeline behavior through release tagging and validation, but does not prescribe one universal pipeline implementation.
Examples
Uses pull-request checks, main-branch pipelines, Git tags, binary artifacts, container images, unit tests, coverage checks, and security scans.
What it assumes
Assumes a Git repository and automated service pipeline, while defining branch validation and release-readiness practices.
What you can do after
Operate a Git workflow that validates feature changes, protects main, and produces traceable releases after successful merges.
How it connects
Connects feature branches, pull requests, continuous integration, service pipelines, release tags, artifact repositories, and container images.

Also explained in

Compare how 4 books explain trunk-based development →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Platform Engineering on Kubernetes. The section links point to the parts of the book it draws on.