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

Improve buildpack packaging #810

Open
runesoerensen opened this issue Mar 25, 2024 · 0 comments
Open

Improve buildpack packaging #810

runesoerensen opened this issue Mar 25, 2024 · 0 comments
Labels
enhancement New feature or request libcnb-package

Comments

@runesoerensen
Copy link
Contributor

runesoerensen commented Mar 25, 2024

When packaging buildpacks using libcnb-package (and by extension, libcnb-cargo), the packaged buildpack.toml is copied directly from the source, and there is no validation that the specified target triple is actually supported by the buildpack.

Additionally, when multiple supported targets are defined in the source buildpack.toml, copying that file to the packaged output directory inherently means that it is never accurate, as libcnb-package currently only support compiling binaries for a single target triple.

We may want to consider:

  • Adapting the functionality of cargo libcnb package (without arguments) to package all targets in buildpack.toml, when specified. This will require mapping supported targets to appropriate (Rust) target triples.
  • Verifying that targets specified in buildpack.toml are compatible with the target triple we're compiling binaries for (including the default). As an example, a buildpack may include a buildpack.toml declaring support for a single target (e.g. linux/arm64), but executing cargo libcnb package will currently:
    • Cause binaries targeting x86_64-unknown-linux-musl (the default) to be compiled, despite the fact that the buildpack explicitly only support a linux/arm64 target.
    • Copy the buildpack.toml verbatim even if the compiled binary does not match the architecture.
  • Rewrite (rather than copying) the packaged buildpack.toml to only list targets that compiled binaries will support. In other words:
    • packaged/x86_64-unknown-linux-musl/debug/foo-buildpack/buildpack.toml should never contain a linux/arm64 target.
    • The packaged buildpack.toml should probably always include a [[targets]] section specifying (at least) the os/arch (e.g. linux/amd64, for the default x86_64-unknown-linux-musl target triple, or linux/arm64 for aarch64-unknown-linux-musl), even when the buildpack.toml source doesn't specify any targets.
  • Support the multi-platform/target directory structure proposed here when merged into the spec.
@edmorley edmorley added libcnb-package enhancement New feature or request labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libcnb-package
Projects
None yet
Development

No branches or pull requests

2 participants