Skip to content

feat(builder): allow omitting buildpack version in --flatten - #2770

Open
samarkumar4355 wants to merge 1 commit into
buildpacks:mainfrom
samarkumar4355:fix/issue-2051-flatten-optional-version
Open

samarkumar4355 wants to merge 1 commit into
buildpacks:mainfrom
samarkumar4355:fix/issue-2051-flatten-optional-version

Conversation

@samarkumar4355

Copy link
Copy Markdown

Summary

Allow passing <buildpack-id> without @<buildpack-version> in pack builder create --flatten.

When @<buildpack-version> is omitted, ParseFlattenBuildModules records the module with an empty version, and managedCollectionV2.flattenedLayerFor matches all versions of that buildpack ID into the requested flattened layer (while giving exact <id>@<version> matches precedence across flatten groups).

Output

Before

pack builder create my-builder --config ./builder.toml --flatten foo/bar failed with:

ERROR: invalid format foo/bar; please use '<buildpack-id>@<buildpack-version>' to add buildpacks to be flattened

After

pack builder create my-builder --config ./builder.toml --flatten foo/bar parses foo/bar with an empty version and flattens all matching versions of foo/bar together into a single layer. Explicit <buildpack-id>@<buildpack-version> continues to match only that specific version.

Documentation

  • Should this change be documented?
    • Yes (the pack builder create --flatten flag description was updated in internal/commands/builder_create.go; buildpacks/docs examples showing --flatten should also reflect that @<buildpack-version> is optional)
    • No

Related

Resolves #2051

Signed-off-by: Samar Kumar <229874045+samarkumar4355@users.noreply.github.com>
@samarkumar4355
samarkumar4355 requested review from a team as code owners December 2, 2026 11:06
@github-actions github-actions Bot added type/enhancement Issue that requests a new feature or improvement. status/triage Issue or PR that requires contributor attention. labels Dec 2, 2026

This branch has not been deployed

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

Labels

status/triage Issue or PR that requires contributor attention. type/enhancement Issue that requests a new feature or improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow omitting buildpack version when using pack builder create --flatten

1 participant