---
title: "Build Pattern: Cumulative Build"
url: "https://osherove.com/blog/2013/2/7/build-pattern-adopt-artifacts.md"
canonical: "https://osherove.com/blog/2013/2/7/build-pattern-adopt-artifacts.html"
published: "2013-02-07T12:55:02"
updated: "2013-02-07T12:55:02"
tags: ["Build Bullet"]
author: "Roy Osherove"
description: "Note : This will become part of my book on beautiful builds . Any comments or feedback are more than welcome, as well as ideas of other common build patterns you see in the wild. Other Names: Distilled Build…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Build Pattern: Cumulative Build

By Roy Osherove February 7, 2013 In [Build Bullet](https://osherove.com/blog/category/build-bullet)

**Historical article** · Originally published February 7, 2013; technical details may be outdated.

**Note**: This will become [part of my book on beautiful builds](http://beautifulbuilds.com/). Any comments or feedback are more than welcome, as well as ideas of other common build patterns you see in the wild.

## Other Names:

- Distilled Build
- Inherit/share/import Artifacts
- Borrow Build Artifacts
- Pre-Chewed Artifacts
- Single Responsibility Build Configuration

## Symptoms:

- Your build configuration on the CI server is taking a long time to complete.
- Each Build Configuration down the build chain takes longer and longer than the build configuration up the chain

## Problem:

Your build config might be doing too many things.

## Forces:

You want your build time to take less, but you do not want to remove any actions from the build because all the build actions are important.

## Solution:

First, Have each build configuration do one thing, and then “share” the resulting artifacts, such as built binaries, so that other build configurations can use them.

Then, for each build down the pipeline, have the build import the artifacts from the build config up the line, and simply do one more action on the artifacts, and share them with the next build up the pipeline.

## For example

say you have the following build configurations in TeamCity before applying the solution:

- **Continuous Integration Build** : Gets from source control, compiles in debug, runs fast tests in debug
- **Nightly Build**: Compiles in debug, runs tests in debug, compiles in release, runs tests in release, runs slow tests on release, deploys to test env.
- **Release Build**: Compiles in debug, runs tests in debug, compiles in release, runs tests in release, runs slow tests on release, deploys to release env.

Here is one way we can make each build do one thing, then share the artifacts with the build up the pipeline:

- **Continuous Integration Build** : Gets from source control, compiles in debug, runs fast tests in debug, _shares source and binaries artifacts_
- **Nightly Build**: _Gets build artifacts from CI build_. Compiles in release, runs fast tests in release, runs slow tests in release. _Shares binaries as artifacts._
- **Release Build**: _Gets build artifacts from nightly build_, deploys to release env. _Shares deployed binaries as artifacts._

Now, each build does just one thing, on top of the pre built binaries. For example, only the first build of the bunch gets from source code. Only two builds compile. The deploy build doesn’t do anything but deploy.

This also eases the build script management, each build gets a separate build script in source control, that can be reused if needed.

## Lessons on this topic

- [Continuous Delivery](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-in-java/continuous-delivery/) · The Art of Unit Testing and TDD in Java
- [Cumulative Builds](https://courses.osherove.com/courses/beautiful-builds-and-continuous-delivery-patterns/cumulative-builds/) · Beautiful Builds and Continuous Delivery Patterns
- [TeamCity Artifacts and Snapshots](https://courses.osherove.com/courses/beautiful-builds-and-continuous-delivery-patterns/teamcity-artifacts-and-snapshots/) · Beautiful Builds and Continuous Delivery Patterns
- [Continuous Delivery with TeamCity](https://courses.osherove.com/courses/tdd-and-bdd-in-ruby/continuous-delivery-with-teamcity/) · TDD and BDD in Ruby
- [Build Dependencies and Snapshot Dependencies](https://courses.osherove.com/courses/tdd-and-bdd-in-ruby/build-dependencies-and-snapshot-dependencies/) · TDD and BDD in Ruby

## More in Build Bullet

[All posts in Build Bullet](https://osherove.com/blog/category/build-bullet)

- Apr 22, 2013

    ### [Beautiful Builds: Release Compilation Step](https://osherove.com/blog/2013/4/23/beautiful-builds-release-compilation-step.html)

- Jan 20, 2013

    ### [Tests and Builds are Made to be Broken](https://osherove.com/blog/2013/1/20/tests-and-builds-are-made-to-be-broken.html)

- Jan 20, 2013

    ### [Build Pattern: Gated Commit](https://osherove.com/blog/2013/1/20/build-pattern-gated-commit.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
