-
Notifications
You must be signed in to change notification settings - Fork 405
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
Implement "strict mode" which requires ko://
prefix for import paths
#58
Conversation
ko://
prefix for image refsko://
prefix for import paths
If you remove
Non- |
When ko is invoked in this mode, import paths must have the `ko://` prefix. If a human marks an import path with `ko://` and ko can't resolve the resulting import path, it fails. In "loose mode", such an import path would be silently ignored and passed on to the resolved YAML, often resulting in invalid image names (e.g., `image: github.com/foo/bar`) In loose mode, `ko://` prefixes are always ignored for backward-compatibility.
Strictness has nothing to do with building, and is independent of how images are built (fixed builder, some future exotic builder type, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple nits but lgtm
pkg/commands/options/strict.go
Outdated
} | ||
|
||
func AddStrictArg(cmd *cobra.Command, so *StrictOptions) { | ||
cmd.Flags().BoolVarP(&so.Strict, "strict", "S", so.Strict, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mildly -1 on including -S
-- we will eventually run out of flags if we keep this up :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I kind of agree. I'll remove -S
until someone complains it's too much to type.
To allow for ko and Go modules to work well, we need to use the `ko://` prefix for our paths. This allows us to use `ko apply --strict ...`. More information can be found in the ko [PR](ko-build/ko#58). Change-Id: I5f33c56465476c81ff73085ccc5776064f8187cf
This allows `ko` to improve the experience with Go modules. See ko-build/ko#58 for more information.
This allows `ko` to improve the experience with Go modules. See ko-build/ko#58 for more information.
Demonstrating a strawman implementation and UX for "strict mode", as described in #9
In strict mode, image references are only considered if they begin with the string
ko://
. In loose mode,ko://
refs are considered as image references and built and replaced during YAML resolution.If we decide to pursue this model, we could start by making strictness opt-in, cut a versioned release of
ko
, then make--strict=true
by default (opt-out), then eventually maybe even remove the option.Sending this out to get feedback on the overall idea; it sounds like Go modules is going to be pretty painful without this as an option at least.