-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Description
Current behavior:
When running func deploy or func build with the --platform flag but without the S2I builder, the command shows an error message that doesn't help users understand what to do:
rayyan@rayyan-seliya:/mnt/c/Users/RAYYAN/Desktop/func/myfunction$ func deploy --registry ghcr.io/user --platform linux/amd64
Error: only S2I builds currently support specifying platformThis forces users to:
- Understand what S2I means (not explained)
- Guess how to enable S2I builder
- Not understand which builders support which features
- Miss the alternative of removing the flag
Proposed improvement:
Provide clear, educational guidance about platform support and builder capabilities:
Error: platform not supported by builder
The --platform flag is only supported with the S2I builder.
Try this:
func build --registry <registry> --builder=s2i --platform linux/amd64
Or remove the --platform flag:
func build --registry <registry>
Builder capabilities:
s2i Supports --platform (Source-to-Image)
pack Does not support --platform (uses default)
host Does not support --platform (uses host architecture)
For more options, run 'func build --help'For func deploy:
Error: platform not supported by builder
The --platform flag is only supported with the S2I builder.
Try this:
func deploy --registry <registry> --builder=s2i --platform linux/amd64
Or remove the --platform flag:
func deploy --registry <registry>
Builder capabilities:
s2i Supports --platform (Source-to-Image)
pack Does not support --platform (uses default)
host Does not support --platform (uses host architecture)
For more options, run 'func deploy --help'Solution:
Implement a 2-layer error system:
- Layer 1 (Technical): Return
ErrPlatformNotSupportedfrom validation inpkg/functions/errors.go - Layer 2 (CLI): Catch the error in
cmd/build.goandcmd/deploy.goand provide user-friendly guidance with examples
Expected Workflow:
According to the official documentation, using platform-specific builds requires:
- Use the S2I builder explicitly:
func build --builder=s2i --platform linux/amd64 --registry <registry> - Or use the default behavior without platform specification:
func build --registry <registry>
The improved error message guides users through the correct usage.
Why S2I Only?
Different builders have different platform support capabilities:
- S2I (Source-to-Image): Supports cross-platform builds via
--platformflag for building container images targeting specific architectures - Pack (Buildpacks): Uses automatic platform detection and doesn't support explicit platform override
- Host: Builds for the host machine's architecture only, no cross-platform support
User Impact:
- Current: Cryptic error → confusion → need to search documentation → time wasted
- Improved: Immediate understanding → clear alternatives → better developer experience → faster onboarding
Metadata
Metadata
Assignees
Labels
No labels