Skip to content
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

Add support for pack build --label #2268

Open
edmorley opened this issue Oct 2, 2024 · 3 comments
Open

Add support for pack build --label #2268

edmorley opened this issue Oct 2, 2024 · 3 comments
Labels
status/discussion-needed Issue or PR that requires in-depth discussion. type/enhancement Issue that requests a new feature or improvement.

Comments

@edmorley
Copy link
Contributor

edmorley commented Oct 2, 2024

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

@edmorley edmorley added status/triage Issue or PR that requires contributor attention. type/enhancement Issue that requests a new feature or improvement. labels Oct 2, 2024
@jjbustamante
Copy link
Member

Hi @edmorley, thanks for creating this issue.
I wonder if this should also be added to the project.toml ?, Maybe for some statics labels that I would like to be added to the final app image I wouldn't need to add --label flag all the time.

@jjbustamante
Copy link
Member

The other that came to my mind is:

Application Image creation is a lifecycle responsibility, which is different for pack builder create and pack buildpack package commands where pack creates the OCI image.

@natalieparellano correct me if I am wrong, but I think we need to create an issue on lifecycle side to expose some option to set custom labels in the app image, and that issue will require an RFC, right?

@natalieparellano
Copy link
Member

Buildpacks can add labels, maybe we need to translate pack build --label to an inline buildpack (or something) that adds a buildpack to the order to add the requested label. That would be my preferred way to do it.

@natalieparellano natalieparellano added status/discussion-needed Issue or PR that requires in-depth discussion. and removed status/triage Issue or PR that requires contributor attention. labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/discussion-needed Issue or PR that requires in-depth discussion. type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

No branches or pull requests

3 participants