Skip to content

build: add options to builder prune - #1327

Merged
tiborvass merged 2 commits into
docker:masterfrom
tiborvass:cmd-builder-prune-with-options
Sep 5, 2018
Merged

build: add options to builder prune#1327
tiborvass merged 2 commits into
docker:masterfrom
tiborvass:cmd-builder-prune-with-options

Conversation

@tiborvass

@tiborvasstiborvass commented Aug 30, 2018

Copy link
Copy Markdown
Collaborator

Signed-off-by: Tibor Vass tibor@docker.com

Related to moby/moby#37651

This patch fixes the UX around build cache:

  • Adds new options to builder prune: --filter, --keep-storage, --all, --force. This is needed to to avoid situations where user needs to prune all their cache, and they can thus prune only a subset of their cache.
  • Shows table layout for build cache in system df consistent with the way other types are shown (containers, images, volumes...)

@tiborvass
tiborvassforce-pushed the cmd-builder-prune-with-options branch 3 times, most recently from d2c48d1 to 8d4de02CompareAugust 30, 2018 21:21
@codecov-io

codecov-io commented Aug 30, 2018

Copy link
Copy Markdown

Codecov Report

Merging #1327 into master will decrease coverage by 0.18%.
The diff coverage is 17.39%.

@@ Coverage Diff @@## master #1327 +/- ##
==========================================
- Coverage 54.82% 54.64% -0.19% 
==========================================
Files 292 293 +1 Lines 19267 19360 +93 ==========================================
+ Hits 10564 10580 +16 - Misses 8044 8119 +75 - Partials 659 661 +2

@tiborvass
tiborvassforce-pushed the cmd-builder-prune-with-options branch 7 times, most recently from e89e1c3 to 82ee8e1CompareSeptember 4, 2018 14:54
@tiborvasstiborvass changed the title [WIP] build: add options to builder prunebuild: add options to builder pruneSep 4, 2018
@tiborvasstiborvass mentioned this pull request Sep 4, 2018

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

Comment threadcli/command/formatter/buildcache.go Outdated
sort.Slice(buildCache, func(i, j int) bool {
lui, luj := buildCache[i].LastUsedAt, buildCache[j].LastUsedAt
switch {
case lui == luj:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit nil check is more readable

Comment threadcli/command/formatter/buildcache.go Outdated
case lui.Equal(*luj):
return strings.Compare(buildCache[i].ID, buildCache[j].ID) < 0
}
return lui.Before(*luj)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: default:

Comment threadcli/command/formatter/disk_usage.go Outdated
buildCacheSort(ctx.BuildCache)
for _, v := range ctx.BuildCache {
t.Execute(ctx.Output, *v)
if !v.Shared {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't filter in here, but in the summary bytes.

This patch adds --filter, --keep-storage, --all and --force to builder prune.
Signed-off-by: Tibor Vass <tibor@docker.com>
@tiborvass
tiborvassforce-pushed the cmd-builder-prune-with-options branch 7 times, most recently from 3c46602 to b774911CompareSeptember 5, 2018 03:30
Signed-off-by: Tibor Vass <tibor@docker.com>
@tiborvass
tiborvassforce-pushed the cmd-builder-prune-with-options branch from b774911 to ca608c2CompareSeptember 5, 2018 03:31

@andrewhsuandrewhsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@tiborvass@codecov-io@vdemeester@andrewhsu@tonistiigi@thaJeztah@GordonTheTurtle