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

31 Commits

Author SHA1 Message Date
Matt Moore
d45c527750
This adds the deprecation notices for ko:// and nonroot (#161)
* Add a deprecation notice when `defaultBaseImage` is not specified.

Related: https://github.com/google/ko/issues/160

* Add a deprecation notice when `ko://` is not specified.

Related: https://github.com/google/ko/issues/158

* Add a sample import path.
2020-05-03 18:42:51 -07:00
Matt Moore
f45bc13ded
Viper keys are case insensitive. (#150)
* Viper keys are case insensitive.

This fixes an issue where import paths with uppercase (github.com/GoogleCloudPlatform 👀) were being canonicalized by Viper to all lowercase and the baseImageOverrides in `.ko.yaml` were failing to properly identify the base image.

I hit this in: https://github.com/tektoncd/pipeline/pull/2435 trying to opt some of the GCP images out of `:nonroot`.

This also adds some logging to a place where I see a lot of folks have issues with `ko` where we swallow an error.  I hit it experimenting with variants on the `ko publish` import path, and added the logging to debug.

* Drop the new log statement
2020-04-20 09:13:33 -07:00
jonjohnsonjr
3c6a907da9
Add additional output formats (tarball and layout) (#134)
* Create a MultiPublisher

MultiPublisher mimics io.MultiWriter in that it will publish an image to
multiple publish.Interface implementations.

* Add publish.{Tarball,Layout}Publisher

This adds support for publishing in the tarball format and to an OCI
image layout.

The tarball format isn't great, yet. It only supports writing once
instead of appending.

* Consolidate options

These were spread all over the place for no reasons. Now all the
publisher related options are grouped together.

* Add options for tarball/layout

Adds --oci-layout-path, --tarball, and --push flags.

--push=false will disable the default behavior of publishing to a
registry.

* go mod vendor

* Add Close method to publish.Interface

This allows us to defer writing to the tarball until we've collected all
the images that have been published.

* Fix tests
2020-02-19 09:30:01 -08:00
jonjohnsonjr
cfd680de28
Deterministically fail ko {apply, create} (#133)
When resolving files, we would just log.Fatal if we encountered an
error. This seems to be racy and causes ko to exit with a 0 error code
when it shouldn't. To fix this, we synchronize the builder goroutines
with the kubectl go routine and exit with an error if either of them
failed.

This fix also happened to fix a goroutine leak. If the kubectl goroutine
failed, we never properly cancelled the builds, which would happily
conitnue compiling packages and consuming resources.
2020-02-11 10:44:25 -08:00
jonjohnsonjr
c3a657a04b
Set AutomaticEnv for viper (#131)
This allows viper configuration to be set using environment variables
instead of just with a config file.
2020-02-06 13:51:22 -08:00
Daniel Helfand
2e28671384 add kubectl check for ko delete, apply, and create (#120) 2020-01-16 13:27:43 -08:00
jonjohnsonjr
b7e1a7fdbc
Update ggcr dependency (#119)
* Update ggcr dependency

I had to move genericclioptions to k8s.io/cli-runtime

* bump client-go

* usePersistentConfig=false
2020-01-15 13:16:11 -08:00
jonjohnsonjr
d24b60a88f
Set UA to something ko-specific (#116) 2019-12-13 15:08:52 -08:00
jonjohnsonjr
835dcfbe44
Improve ko run (#76)
Make it more like go run.
2019-12-06 10:52:34 -08:00
Stanley Nguyen
1c54dd6b3e Add context to go build (#105) 2019-11-09 09:23:09 -08:00
Adam Harwayne
5a25402af9 Ignore null YAML documents when using a label selector. (#107) 2019-11-07 16:12:23 -06: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
jonjohnsonjr
3880b61d2d
Allow plain registries as KO_DOCKER_REPO (#94)
This allows you to use e.g. localhost:5000 as KO_DOCKER_REPO.

Fixes #93.
2019-10-02 10:02:01 -07:00
jonjohnsonjr
f26825fb5a
Remove extra dashes (#86) 2019-09-20 09:39:18 -07:00
Jason Hall
133ae27c63 Use debug.ReadBuildInfo to populate ko version (#81)
* Use debug.ReadBuildInfo to populate `ko version`

* don't print version on build info failure

* Build using Go 1.12 and 1.13

* drop 'version: ' prefix

* println
2019-09-12 14:59:50 -07:00
jonjohnsonjr
99a587ede5
Add build.Limiter (#79)
* Add build.Limiter

You can limit the number of concurrent builds with -j (a la make).

The default value for this is GOMAXPROCS, which seems reasonable.
2019-09-11 10:07:02 -07:00
Jason Hall
91f571887c Make callers type out all of --strict 2019-08-15 21:44:56 -04: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
4342ceff74 Implement "strict mode"
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.
2019-08-15 09:45:59 -04:00
tanner-bruce
48afd62710 Allow skipping TLS verification while publishing (#65)
Why this is necessary: when using a local docker registry, users may not
want to support https, or there may be other troubles not allowing
verifiable TLS support.

This commit adds this functionality by adding an `--insecure-registry`
flag.
2019-07-24 10:58:10 -07:00
jonjohnsonjr
3566d3f01a
Add go module support (#60)
* Add go module support

* Make localimports work for go modules
2019-07-12 22:54:25 -07:00
Marek Schwarz
0af2e5e8a9 Added command completion (#49)
* Enable command completion (#27)

* Added documentation (#27)
2019-07-08 17:04:58 -07:00
Scott Weiss
0c205ab8e4 add selector flag and logic (#46)
* add selector flag and logic

* comments, cleanup

* add readme note for selector flag

* preserve comments, fix nits

* readme nit
2019-06-27 13:55:47 -07:00
jonjohnsonjr
116114f1f9
Bump ggcr depenency (#41)
* Update ggcr dependency

* Update kode

Fixed remote.Write interface change.

Drop name.WeakValidation (now default).
2019-06-21 13:15:10 -07:00
Naomi Seyfer
9bae8ab408 Print images to stdout as we publish them. (#36) 2019-05-31 10:20:09 -07:00
cezkuj
672e478602 Resolving #21 issue. Adding git-dir flag to always execute inside ko's directory in GOPATH 2019-05-17 05:54:03 +00:00
cezkuj
0aca6f6de8 Resolving #21 issue. Fixing conflicts after commands refactoring. Improving version command 2019-05-12 15:16:12 +00:00
jonjohnsonjr
cef9764e3d
Return better error messages (#33)
This hoists the publisher creation out of the loop for `ko publish` to
avoid needlessly resolving credentials multiple times.

This pulls the publisher creation outside of resolveFilesToWriter so we
can fail earlier if e.g. KO_DOCKER_REPO is unset, otherwise we start up
the kubectl goroutine and it would asynchronously fail with:

  error: no objects passed to apply
2019-04-30 13:08:54 -05:00
Scott Nichols
7c4a93a717 Adding create. (#30) 2019-04-26 16:28:22 -07:00
Scott Nichols
6f9fb7f753 Move ko commands to pkg/commands (#29)
* Move commands to pkg/commands and split into files.
2019-04-26 15:56:15 -07:00
Scott Nichols
fba1d3d90a Moving options to pkg/commands/options. (#28) 2019-04-26 15:25:40 -07:00