Open edmorley opened 5 days ago
I also think separately this error wording needs updating too: https://github.com/buildpacks/pack/blob/ce8db3c5d11b8e040fd565632668a697e53e4f87/internal/commands/config_trusted_builder.go#L81-L85
(Since it's not only suggested builders that are trusted by default, but any of the "built-in trusted builders")
Summary
The
pack build
command is not correctly treating builders as trusted after #2043. Specifically, if a builder is "trusted but not suggested" thenpack build
treats it as untrusted, even though the builder still shows up as trusted in the output ofpack config trusted-builders
.Reproduction
Steps
rm ~/.pack/config.toml
mkdir testcase && touch testcase/requirements.txt
pack build --builder heroku/builder:22 --path testcase testapp --verbose
Current behavior
The
heroku/builder:22
builder is treated as untrusted bypack build
:Expected behavior
For
heroku/builder:22
to be treated as a trusted builder, given that thepack config trusted-builders
Pack CLI command lists it under trusted builders:...and that it's marked as trusted here: https://github.com/buildpacks/pack/blob/ce8db3c5d11b8e040fd565632668a697e53e4f87/internal/builder/known_builder.go#L28-L31
Notes
This appears to be caused by a bug here: https://github.com/buildpacks/pack/blob/ce8db3c5d11b8e040fd565632668a697e53e4f87/internal/commands/commands.go#L108-L116
In that function, the
return isSuggestedBuilder(builder)
line should instead bereturn isTrustedBuilder(builder)
.It looks like when the concept of "suggested" vs "trusted" builders was added in https://github.com/buildpacks/pack/commit/1b68d1261eb8e8f01aade2737d5268e54f4a4604 some places in the codebase weren't updated along with the others.
This is why
pack config trusted-builders
says the builder is trusted, butpack build
says it is not.In addition to fixing this bug, it seems worth reducing the number of places that implement the same "is this a trusted builder" check to avoid issues like this (where the behaviour of different Pack subcommands for common functionality can diverge). Plus this comment needs updating too.
cc @colincasey @schneems
Environment
pack info
docker info
N/A