1
0
mirror of https://github.com/ko-build/ko.git synced 2024-12-12 08:54:09 +02:00
Commit Graph

7 Commits

Author SHA1 Message Date
Matt Moore
ff61ea330c
Refactor how/where ko:// is handled. (#153)
This change more or less completely changes how `ko://` is handled internally to `ko`, but the user-facing changes should only be net-positive.  `ko://` was previously stripped at the highest level, and the build logic was unaware, which had some undesirable diagnostic/functional implications that are collectively addressed in this change.

With this change, the `ko://` prefix is preserved and passed to the build logic, which internally parses a new `reference` type (this was useful to have Go's type checker find all of the places that needed fixing).  The main functional differences are:
1. If a reference is prefixed with `ko://` we will now fail fast in `IsSupportedReference` regardless of whether `--strict` is passed.
2. If a reference is prefixed with `ko://` it will bypass the prefix check, which allows the use of `ko://github.com/another/repo` that references a vendored binary package.

For `2.` the absence of the module prefix causes the filtering logic Jon introduced to avoid the reference.  This was critical for efficiency when `ko://` isn't around because we feed every string in the yaml through it, but when the user has explicitly decorated things it's the perfect thing to be sensitive to.

Fixes: https://github.com/google/ko/issues/146
Fixes: https://github.com/google/ko/issues/152
2020-04-29 19:32:30 -07:00
Stanley Nguyen
1c54dd6b3e Add context to go build (#105) 2019-11-09 09:23:09 -08:00
Dave Protasowski
4833bb4a3e Preserve YAML comments & style when resolving/applying (#103)
* Preserve YAML comments & style when resolving/applying

This is accomplished by adopting the yaml.v3 lib. It
exposes a Node struct that's used internally by the
yaml encoder/decoder

ko internally now manipulates YAML documents using this struct

Fixes #101

* add/remove vendored modules

* Apply suggestions from code review

Fix comments

Co-Authored-By: jonjohnsonjr <jonjohnson@google.com>

* update doc link

* Fix use of yaml.Decoder in a test

When the yaml.Decoder returns an io.EOF it implies
there were no YAML documents decoded and that there
are no more!

* Update pkg/resolve/resolve.go

resolve comment suggestion

Co-Authored-By: jonjohnsonjr <jonjohnson@google.com>

* leave ko prefix if we're not operating in strict mode

* move testutils to internal/testing
2019-11-05 12:24:08 -08:00
Jason Hall
3315663a21 Remove strictness checks from build, into resolve
Strictness has nothing to do with building, and is independent of how
images are built (fixed builder, some future exotic builder type, etc.)
2019-08-15 14:22:45 -04:00
Jason Hall
86a2d43f43 Drop name.WeakValidation 2019-03-22 15:02:13 -04:00
Jason Hall
ab8152ad0a Update ko to ggcr head, update ggcr vendor 2019-03-21 18:51:39 -04:00
Jason Hall
6354665a42 Initial commit 2019-03-14 14:23:47 -04:00