liveBook · Manning

Trunk-based development

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

Trunk-based development is a workflow that integrates small, incremental changes directly into a shared main branch with short-lived or no feature branches.

Trunk-based development applies every change directly to the shared main branch instead of isolating work in feature branches. It favors small, incremental infrastructure changes and uses testing environments to verify them before production. section 7.2.2

A practical infrastructure workflow is:

  • Clone the configuration repository and confirm that the working copy is on main. section 7.2.2
  • Make a small change, commit it, and update the local copy with git pull --rebase. section 7.2.2
  • Push to main, run unit and integration tests in a testing environment, and wait for team approval before production delivery. section 7.2.2

The shared branch imposes ordering: teammates cannot evolve changes independently, but conflicts and the commit causing a failure become easier to identify. The pattern reduces blast radius through incremental changes, while requiring discipline, organization, and a long-lived testing environment. It lacks a separate manual-review stage before merging. section 7.2.2 section 7.2.3

Firewall configuration changes

One engineer commits a firewall rule change to main first. A teammate pulls the updated repository, commits a firewall license update, and pushes afterward. The pipeline tests each change against a testing environment before approval and production delivery. section 7.2.2

Figure 7.13 When you use trunk development, you maintain one main branch and update the production configuration directly.

Shows the single-main-branch collaboration model used for direct configuration updates. section 7.2.2

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Explains definitions, Git steps, pipeline stages, benefits, limitations, and testing requirements without detailing implementation internals.
Examples
Uses firewall rules, firewall licenses, Git commands, delivery pipelines, unit tests, integration tests, and manual approval.
What it assumes
Assumes shared version control and a testing environment with automated tests; requires team discipline and organization to scale.
What you can do after
Apply via Git and a continuous delivery pipeline to coordinate small infrastructure changes and identify conflicting commits.
How it connects
Connects version control, infrastructure as code, continuous integration, continuous delivery, testing environments, and feature-based development.

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 Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.