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

build_libcnb_buildpacks_dependency_graph() displays the wrong error for buildpack.toml IO and TOML parsing errors #708

Open
edmorley opened this issue Oct 31, 2023 · 0 comments
Labels
bug Something isn't working libcnb-package

Comments

@edmorley
Copy link
Member

edmorley commented Oct 31, 2023

The determine_buildpack_kind() function currently returns Option<BuildpackKind>:

pub fn determine_buildpack_kind(buildpack_dir: &Path) -> Option<BuildpackKind> {
read_toml_file::<BuildpackDescriptor>(buildpack_dir.join("buildpack.toml"))
.ok()

Unfortunately, this means it treats "this isn't a buildpack" the same as "an error occurred trying to work out what type of buildpack this is" (which in practice can be IO errors or TOML parsing errors).

This has the knock on impact of the filter here (inside build_libcnb_buildpacks_dependency_graph()) skipping over buildpacks with malformed TOML:
https://github.com/heroku/libcnb.rs/blob/2698a713edf19034e382aa702e12acc1516da8fa/libcnb-package/src/buildpack_dependency_graph.rs#L36C1-L41

Which means that the packaging process continues on further than it should, and then a confusing error message is shown instead of a "unable to parse TOML" error:

Error while creating dependency graph: Node references unknown dependency libcnb-test/a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libcnb-package
Projects
None yet
Development

No branches or pull requests

1 participant