1
0
mirror of https://github.com/ko-build/ko.git synced 2025-02-13 19:42:26 +02:00

301 Commits

Author SHA1 Message Date
dependabot[bot]
d5b606e919
Bump golang.org/x/tools from 0.1.5 to 0.1.6 (#441)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.5 to 0.1.6.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.5...v0.1.6)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 07:26:56 -04:00
jonjohnsonjr
45467f076b
Do not require docker installed for tests (#438) 2021-09-20 07:07:56 -04:00
dependabot[bot]
e73be50bbe
Bump k8s.io/apimachinery from 0.22.0 to 0.22.2 (#440)
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.22.0 to 0.22.2.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.22.0...v0.22.2)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 07:07:21 -04:00
jonjohnsonjr
61d5250c55
Drop scary warning (#439) 2021-09-16 10:48:12 -07:00
Chmouel Boudjnah
eef795f19c
Update OpenShift instructions to point to latest (#437)
* Update the OpenShift documentation url to use latest instead of a specific version.
* Use `openshift registry info --public` to get registry public URL
2021-09-15 06:20:43 -04:00
Matt Moore
501111b063
Bump to Go 1.16.x (#435) 2021-09-13 10:40:29 -07:00
Jason Hall
35a4d2c28e
Warn that watch mode is deprecated (#434)
Also update generated markdown docs, and omit unnecessary autogenerated
bits.
2021-09-13 10:30:28 -07:00
dependabot[bot]
7f145a7e10
Bump github.com/containerd/stargz-snapshotter/estargz (#431)
Bumps [github.com/containerd/stargz-snapshotter/estargz](https://github.com/containerd/stargz-snapshotter) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/containerd/stargz-snapshotter/releases)
- [Commits](https://github.com/containerd/stargz-snapshotter/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: github.com/containerd/stargz-snapshotter/estargz
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-06 06:23:51 -04:00
dependabot[bot]
a965b407b2
Bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.1 (#430)
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.4.9 to 1.5.1.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.4.9...v1.5.1)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-30 07:41:08 -04:00
Halvard Skogsrud
1fcfd75417
Use working directory and build config dir (#427)
* Use working directory and build config `dir`

Use the working directory from `BuildOptions` to load `.ko.yaml`.

Also, use the `dir` build config field to load package information,
instead of assuming that `go.mod` is in the current working directory.

This removes the `init()` function from `./pkg/commands/config.go`.

And avoids the global viper instance, which caused some Heisenbugs (and
associated hair loss).

Fixes: #422, #424

* Return error instead of log.Fatal

`log.Fatal` is no longer needed in `loadConfig()`, since it's no longer
an `init()` function.

Also removed `log.Fatal` from `createBuildConfigMap()`.
2021-08-27 09:55:39 -07:00
Halvard Skogsrud
29fccb0832
Speed up base image unit test with local registry (#429)
Also follow my own advice to `defer Close()` 😇
2021-08-27 09:52:01 -07:00
Halvard Skogsrud
ae594dcc74
Set build config via BuildOptions (#421)
* Set build config via BuildOptions

Enables programmatically overriding build configs when ko is
embedded in another tool.

Related: #340, #419

* Use local registry for base images in unit tests

Tests create a local registry (using ggcr) with a dummy base image. This
speeds up tests, since they don't need to hit gcr.io to fetch the
default distroless base image.

* Update function comment to refer to random image
2021-08-26 09:33:01 -07:00
Jason Hall
335c1ac8a6
Delete .travis.yml (#428) 2021-08-23 08:53:53 -07:00
Halvard Skogsrud
9a256a4b19
Enable setting environment variables in .ko.yaml (#419)
* Enable setting environment variables in .ko.yaml

Matches the GoReleaser format.

Related: #340

* Use different env example
2021-08-23 08:05:01 -07:00
Halvard Skogsrud
040b7c7698
Ignore cobra auto-generate comments in doc diff (#420)
spf13/cobra inserts comments with dates in generated Markdown files.

This change makes the presubmit check ignore those comments when
verifying that ko's Markdown docs are up-to-date.

Also fixes some `shellcheck` warnings.
2021-08-19 08:47:47 -07:00
Jason Hall
780c281292
Generate Markdown docs (#414)
* Generate Markdown docs

This is largely copied from similar work in go-containerregistry

This required moving the Root command definition out of main() into a
place where it could be referenced from the gendoc tooling.

* fix boilerplate

* moar fix boilerplate

* update cmd/ko/main.go

* set -j to GOMAXPROCS at runtime

* rebase on cli-runtime change

* remove trailing whitespace
2021-08-11 13:54:13 -07:00
Jason Hall
86a7b6f4b8
Don't set image.base.name if base is specified by digest (#408)
* Don't set image.base.name if base is specified by digest

* don't set empty annotation

* annotate Results, not Images and Indexes separately

* moar cleanup

* skip annotations check for images in indexes, these won't be annotated anymore
2021-08-11 16:52:01 -04:00
Jason Hall
466dbab6c4
Remove dependency on cli-runtime (#413)
* first pass: kubectl flags must be passed after '--'

* add warning when using non-separated flags

* mark flags as deprecated

* drop defaultCacheDir and homedir dependency
2021-08-10 13:57:23 -04:00
dependabot[bot]
9f6e0d305b
Bump github.com/docker/docker (#410)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.7+incompatible to 20.10.8+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.7...v20.10.8)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-08 22:56:17 -04:00
Jason Hall
4ff8308086
Use annotation strings from image-spec/specs-go (#407) 2021-08-03 20:00:24 -04:00
Jason Hall
24e371ae56
bump go-containerregistry dep (#404) 2021-07-30 14:11:26 -04:00
Jason Hall
8c7b9cbb8b
Implement ko deps (#403)
* Implement ko deps

* actually add deps.go

* specify auth, useragent, platform

* stop reading tar if the context is cancelled

* chmod to the file's perms

* remove support for --platform, modules don't care about build tags

* fix copyright boilerplate

* drop fs dependency

* udpate module integration test to newer Go versions

* use entrypoint to identify the binary

* fix gosec finding, some style comments

* revert modules integration test change
2021-07-30 13:19:40 -04:00
Jason Hall
305f086c4e
Delete ko binary that leaked into the repo (#401)
This snuck in with #374
2021-07-30 10:12:53 -07:00
Jason Hall
c9efd26241
Annotate OCI image indexes with base image information (#385) 2021-07-30 09:29:58 -07:00
Jason Hall
f16d0d0412
Don't add .exe suffix to windows executables (#400) 2021-07-28 16:28:22 -04:00
Evan Anderson
f04730dc84
Make --insecure-registry work with TLS registries whose certs we can't verify. (#398)
* Make --insecure-registry work with TLS registries whose certs we can't verify.

* Don't error if we can't disable TLS checking when insecure.
2021-07-28 13:23:45 -07:00
Hong Xu
18096666c9
Update "go install" instructions (#377)
I got the following error when following the original instructions:

    go install: version is required when current directory is not in a module
            Try 'go install github.com/google/ko@latest' to install the latest version
2021-07-27 17:57:55 -04:00
Jason Hall
690533235a
Build working Windows container images (#374)
* Build working Windows container images

Add e2e tests that run on Windows and cover kodata behavior

* now successfully skipping symlinks on windows :-/

* fix e2e test on windows, that relied on a symlink in kodata after all

* document windows symlink issue

* review feedback

* re-add kodata symlink tests for linux
2021-07-27 16:19:21 -04:00
Jason Hall
e947aa378d
update deps (#392) 2021-07-27 15:40:24 -04:00
Evan Anderson
7b8b24fa32
Silence usage report on internal errors (#397) 2021-07-26 15:48:07 -07:00
Jason Hall
c014ec1feb
disable travis arm64 builds (#395) 2021-07-26 11:52:09 -04:00
dependabot[bot]
4d17e6e284
Bump k8s.io/apimachinery from 0.20.6 to 0.21.3 (#391)
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.20.6 to 0.21.3.
- [Release notes](https://github.com/kubernetes/apimachinery/releases)
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.20.6...v0.21.3)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-26 09:48:01 -04:00
Jason Hall
30716ad823
Enable dependabot (#386) 2021-07-23 13:58:39 -04:00
Jason Hall
26d03e92c2
Annotate images with base image information (#354)
* WIP: annotate base images

* remove TODO

* .

* Annotate with base index digest, if based on an index

* use correct new proposed annotation
2021-07-20 15:06:08 -05:00
Jason Hall
56282bf645
Fix layout tests on macos (#384) 2021-07-15 10:16:24 -04:00
Halvard Skogsrud
8295e25f7d
Enable overriding docker client (#378)
When embedding ko, it may be necessary to override the docker client.

This adds a PublishOption to inject a docker client created elsewhere.
Ko will use this client to interact with the docker daemon.

Context: https://github.com/GoogleContainerTools/skaffold/pull/6054#discussion_r662230195
2021-07-15 07:10:52 -07:00
Jason Hall
674932fb2c
Use helm/kind-action to set up KinD cluster (#381)
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
2021-07-14 20:29:27 -04:00
Jason Hall
ef45f113e8
Allow KinD e2e tests to be run manually (#380) 2021-07-14 14:00:11 -07:00
Matthias Diester
ab4d264103
Add support for Go build flags (#340)
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`.
2021-07-02 08:40:56 -07:00
Simon Kirsten
ee23538378
Add KO_DATA_DATE_EPOCH env var to set the modification time for files in kodata (#372)
* Add KO_DATA_DATE_EPOCH env var

* Add documentation for KO_DATA_DATE_EPOCH env var
2021-06-15 12:50:35 -07:00
Halvard Skogsrud
2ba8bb26d1
Enable setting the working dir for the go tool (#365)
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.
2021-06-10 08:29:30 -07:00
Jason Hall
380705fd26
Document KIND_CLUSTER_NAME env var in README.md (#373) 2021-06-09 13:13:33 -04:00
jonjohnsonjr
82e899db0c
Look for ko.local in the daemon (#371)
* Look for ko.local in the daemon

* Update README
2021-06-09 09:20:45 -07:00
jonjohnsonjr
23ecf4753b
Propagate --insecure-registry to base image (#370) 2021-06-01 09:47:30 -07:00
Halvard Skogsrud
d6b3a3cba3
Enable embedding of ko publish (#348)
- 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.
2021-05-25 11:44:52 -07:00
Jason Hall
21728fdbb0
Fix typo in stale GitHub Action (#367) 2021-05-21 08:36:16 -07:00
Chun-Hung Hsiao
bc92184f85
Add a tag-only flag to publisher. (#332)
Co-authored-by: chhsia0 <chhsiao@mesosphere.io>
2021-05-17 08:26:15 -07:00
Halvard Skogsrud
a68d0ab75f
Enable override of daemon publisher local domain (#362)
* 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
2021-05-17 08:25:47 -07:00
Jason Hall
9814e6e0e4
Break free from Knative actions (#364) 2021-05-16 10:32:29 -04:00
knative-automation
1b023d3020
Update actions (#363)
Signed-off-by: Knative Automation <automation@knative.team>
2021-05-12 14:34:56 -04:00