knative / knative/func

func builders: add disk usage report and prune command

Open
#4,047 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
365
Forks
223
Avg merge
2d 3h
Merged PRs (30d)
25

Description

Hey! I've been using func build regularly across a few projects, and noticed something that might be worth a small feature wanted to check with you before writing any code.

The problem:

`func build` pulls builder images, run images, and creates buildpack cache layers on every run. Caching is clearly already happening (the CLI notes first builds are slower than later ones), but there's currently no way to see:

- how much disk space these images/layers are using
- which builder/run images are still active vs. left over from old projects
- whether a slow build is a cache miss or something else

Across multiple functions and projects, this accumulates with no built-in way to inspect or clean it up.

1. `func builders prune` reports disk usage per builder image, run image, and cache layer, with an option to remove ones no longer referenced by any local `func.yaml`.
2. `--cache-report` flag on `func build` prints a per-layer cache hit/miss summary.

I checked open and closed issues/PRs for related prune/cache/disk-space work and didn't find anything in progress. If this was discussed or attempted before, I'd appreciate the context. Otherwise, happy to write a short design doc scoping this into reviewable pieces reporting first, prune as a follow-up.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing `func build` and `func builders` CLI entry points and how builder images, run images, and buildpack cache layers are tracked. Define how local `func.yaml` references determine prune eligibility and separate reporting, pruning, and `--cache-report` into reviewable pieces. Done means the scope and behavior are specified clearly enough for implementation and testing.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.