Skip to content

Add support for pack build --label #2268

Open
@edmorley

Description

Description

The pack builder create and pack buildpack package commands both support a --label argument for adding OCI image labels to the builder and buildpacks images respectively, added in #2034 and #1877. Similarly, buildpacks can set app image labels via the [[labels]] table in launch.toml - for example as used by paketo-buildpacks/image-labels.

However, it's not currently possible to add labels to the app image when calling pack build.

This means that in basecamp/kamal#916 the service label required by Kamal can't be set when calling pack build, and instead the paketo-buildpacks/image-labels buildpack has to be injected. This has a couple of downsides:

  1. The builder's default buildpack order is overridden, so now the user must always specify an explicit list of buildpacks rather than being able to rely on the curated defaults in the builder should they wish.
  2. Users may get confused why there are more buildpacks being run than the list of buildpacks they requested, given that an extra buildpack has had to be injected.

If pack build supported setting image labels natively, then there would be no need to use this buildpack injection based approach.

Proposed solution

Add --label support to pack build, similar to that already supported by pack builder create and pack buildpack package.

cc @nickhammond

Metadata

Assignees

No one assigned

    Labels

    status/discussion-neededIssue or PR that requires in-depth discussion.type/enhancementIssue that requests a new feature or improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions