Conversation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
e94c402 to
adc30fa
Compare
jsternberg
left a comment
There was a problem hiding this comment.
Curious about this. Should we instead make it a warning or an error to use the non-normalized version? A big difference between this and the command line is that command lines are usually more ephemeral. It seems to me like we'd want the underlying HCL file to be consistent since it gets checked into the repository.
We could also error when the named contexts are in conflict and only warn when they differ from the canonical name.
I considered making non-normalized names an error, but that would reject the exact configuration from #2328 and make Bake behave differently from BuildKit normalizes the Dockerfile reference before looking up the named context, so Bake needs to apply the same normalization when creating the frontend attributes. I kept non-conflicting aliases valid, but added an error when multiple keys normalize to the same name because that case is genuinely ambiguous. |
fixes #2328
Bake now normalizes named context keys in the same way as
docker buildx build --build-contextand the Dockerfile frontend. Contexts such aslibrary/golanganddocker.io/library/golangtherefore resolve correctly when referenced byFROMorCOPY --from. Ambiguous keys that normalize to the same name produce a deterministic error instead of selecting an arbitrary value.