Also:
- collect and upload logs as build artifacts
- don't bother testing many k8s versions
- don't checkout and install into GOPATH
- install ko from ./ to avoid warning
- remove unnecessary knative cruft
There are use cases, where multiple Go build flags need to be set. However, the
environment variable to pass flags to Go build has some limits for `ldFlags`.
Add GoReleaser inspired configuration section to `.ko.yaml` to support setting
specific Go build and ldFlags to be used by the build. Like GoReleaser the
content of the configuration can use Go templates. Currently, only a section
for environment variables is included.
In order to reduce dependency overhead, only the respective config structs from
https://github.com/goreleaser/goreleaser/blob/master/pkg/config/config.go are
used internally to load from `.ko.yaml`.
This change adds a `WorkingDirectory` field to `options.BuildOptions`,
but doesn't expose this as a CLI flag. The default zero value means the
current working directory. The value is used as the directory for
executing `go` tool commands.
When embedding ko in other tools, it is sometimes necessary to set the
working directory for executing the `go` tool, instead of assuming the
current process working directory.
An example of where this is required from Skaffold:
https://github.com/GoogleContainerTools/skaffold/tree/master/examples/microservices
In this example, the working directory doesn't contain either `go.mod`
or any Go files. The `skaffold.yaml` configuration file specifies
a `context` field for each image, which is the directory where the `go`
tool can find package information.
- Export functions and a variable to enable embedding of ko's
`publish` functionality to be embedded in other tools.
See https://github.com/GoogleContainerTools/skaffold/pull/5611
- Remove DockerRepo PublishOption and flag.
This removes the `DockerRepo` config option and `--docker-repo`
flag from the PR.
New PR with the extracted config option:
https://github.com/google/ko/pull/351
- Fix copyright headers for boilerplate check.
- Use DockerRepo PublishOption instead of env var.
- Override defaultBaseImage using BuildOptions.
Remove exported package global SetDefaultBaseImage and instead
allow programmatic override of the default base image using
the field `BaseImage` in `options.BuildOptions`.
Also fix copyright header years.
- Add BuildOptions parameter to getBaseImage
This enables access to BaseImage for programmatically overriding
the default base image from `.ko.yaml`.
- Add UserAgent to BuildOptions and PublishOptions
This enables programmatically overriding the `User-Agent` HTTP
request header for both pulling the base image and pushing the
built image.
- Rename MakeBuilder to NewBuilder and MakePublisher to NewPublisher.
For more idiomatic constructor function names.
* Enable override of daemon publisher local domain
Add a `LocalDomain` field to `PublishOptions`, but no flag (yet?).
This allows use of a domain (base repo) other than `ko.local` for images
that are side-loaded to the local Docker daemon.
An alternative implementation would be to add a boolean field that
indicates that `ko publish` should use the value of the `KO_DOCKER_REPO`
environment variable (or the `DockerRepo` field in `PublishOptions`) as
the base name for images side-loaded to the local Docker daemon. I'd be
happy to get feedback on which option would work best.
* Restore NewDaemon tags positional arg
* Add flag and PublishOption for destination repo
This enables programmatically setting the destination image repository
when embedding ko's `publish` functionality in other tools.
See https://github.com/google/ko/pull/348
* Set DockerRepo PublishOption from KO_DOCKER_REPO
This enables programmatically setting the destination image repository
and avoids exposing a flag.
* Update comment on DockerRepo option
* Fix readme and copyright headers