Skip to content

Add documentation for build pruning #4536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions admin_guide/pruning_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ $ oadm prune builds --orphans --keep-complete=5 --keep-failed=1 \
--keep-younger-than=60m --confirm
----

[NOTE]
====
Developers can enable xref:../../dev_guide/advanced_build_operations.adoc#build-pruning[automatic build pruning]
by modifying their build configuration.
====

[[pruning-images]]

== Pruning Images
Expand Down
34 changes: 34 additions & 0 deletions dev_guide/builds/advanced_build_operations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,37 @@ whenever the first build is run and produces a new image with the binary
artifact, the second build is automatically triggered to produce a runtime image
that contains that artifact. Therefore, both builds behave as a single build
with two stages.

[[build-pruning]]
== Build Pruning

By default, builds that have completed their lifecycle are persisted indefinitely.
You can limit the number of previous builds that are retained by supplying a positive
integer value for `successfulBuildsHistoryLimit` or `failedBuildsHistoryLimit`
as shown in the below sample build configuration.

[source,yaml]
----
apiVersion: "v1"
kind: "BuildConfig"
metadata:
name: "sample-build"
spec:
successfulBuildsHistoryLimit: 2 <1>
failedBuildsHistoryLimit: 2 <2>
----
<1> `successfulBuildsHistoryLimit` will retain up to 2 builds with a status of `completed`
<2> `failedBuildsHistoryLimit` will retain up to 2 builds with a status of `failed`, `cancelled`, or `error`

Build pruning is triggered by the following actions:

- the build configuration is updated
- a build completes its lifecycle

Builds are sorted by their creation timestamp with the oldest builds being pruned first.

[NOTE]
====
Administrators can manually prune builds using the xref:../../admin_guide/pruning_resources.adoc#pruning-builds[oadm object pruning command].
====