Commit Graph
94 Commits
Author SHA1 Message Date
Jason Hall aafd3e863b Revert "Produce OCI images by default (#623)" (#653)
This reverts commit 7e9709a63a.
2022-03-18 11:30:56 -04:00
Jason Hall 204fbc9724 Correctly pass through base image annotations (#636)
There were some bugs here before:

- for indexes, we'd annotate the base, but then append to empty.Index
  which didn't carry those forward.
- when producing single-platform images based on multi-platform indexes
  (the default and most common scenario), we wouldn't carry forward the
  original base index's annotations to the single matching platform base
  image.
2022-03-07 14:12:19 -05:00
Jason Hall 7e9709a63a Produce OCI images by default (#623)
* Produce OCI images by default

This changes build logic to prefer to produce OCI images and indexes,
even if original base images are Docker manifests or manifest lists.

OCI indexes support annotations, while Docker manifest lists do not, and
we'd like to inject base image information in annotations wherever possible.

Since Quay.io recently added support for OCI manifests, this is no
longer a serious breaking change -- and anyway, producing SBOMs by default
already breaks Quay.io without --sbom=none.

This behavior can be disabled with --preserve-docker-media-type=true,
which will result in Docker-type manifests being produced if and only if
the base image was a Docker-typed manifest.

This partially reverts commit 42723d75e7.

* drop e2e test

* update generated docs

* --preserve-media-type

* docs
2022-03-04 16:21:06 -05:00
Jason Hall cd41b3e714 Remove --watch mode (#585) 2022-03-03 14:58:34 -05:00
Jason Hall 967e3ebb2d rm cmd/ko/main.go (#628) 2022-03-02 16:42:54 -05:00
Jason Hall f40d2dcca1 Update Go 1.18 code to match RC 1 (#631) 2022-03-02 13:28:32 -05:00
Jason Hall eb2597f975 Update 'ko publish' -> 'ko build' in README (#601) 2022-02-17 17:05:35 -05:00
Jason Hall 70f0273018 Introduce --verbose flag that enables logs.Warn logs (#600)
* Introduce --verbose flag that enables logs.Warn logs

* regenerate docs
2022-02-17 08:34:43 -08:00
Jason Hall 3fc720f912 Update ecr-login dependency to allow us to avoid logspam (#586) 2022-02-16 15:33:47 -05:00
Jason Hall a41529ebf4 Fix Windows e2e test (#599)
Use nanoserver:ltsc2022 and correct osversion
2022-02-16 14:48:14 -05:00
Jason Hall 0187841b16 Sign image using cosign (#595)
Annotate signature with run information
2022-02-13 15:58:38 -08:00
Jason Hall 98ff104f1a Generate CycloneDX SBOMs using our own JSON generation (#587)
* Generate CycloneDX SBOMs using our own JSON generation

* fix some errors

* Add support to ko deps

* Add e2e SBOM validation

* ignore empty hashes (why are hashes empty?)
2022-02-11 16:49:53 -05:00
Jason Hall f8d0aca1ab Log base image@digest when building (#592)
* Log base image@digest when building

* Only log full digest if the original base wasn't already specified by digest

* Remove redundant image ref
2022-02-11 10:39:19 -05:00
Jason Hall 89ede9110a Include cred helpers in keychain (#581)
This adds implicit support for Google, Amazon, Azure and GitHub
container registries if the environment provides credentials.

Binary size increases from 22 MB -> 26 MB
2022-02-08 15:20:31 -05:00
Jason Hall 1425e4be74 Add a mutex to map writing when using KOCACHE (#580) 2022-02-02 14:34:57 -05:00
Jason Hall e961890072 Set GOAMD64 if variant is set (#578)
This change also changes behavior of GOARM, since docs suggest that it's
only used when the GOARCH=arm, and not arm64.
2022-02-01 16:46:32 -05:00
Jason Hall 5f733f9ac6 Support partial platform matching for osversion only (#572)
* Support partial platform matching for osversion only

* Add doc comment

* lint fixes

* pick up Platform.String and v1.ParsePlatform

* go mod tidy && go mod vendor
2022-01-27 17:06:35 -05:00
Jason Hall 8135bf22e9 Set config creation time without mutating (#524)
* Set config creation time without mutating

* only set creation time if set

* drop creationTime from buildLayer entirely
2021-12-16 14:07:15 -05:00
Jason Hall 33fa766168 Support osversion when selecting base images (#536)
* Support osversion when selecting base images

Use this in e2e tests.

Also clean up usage of bo.Platform vs a new platform var.

* use correct osversion
2021-12-15 16:08:27 -05:00
Jason Hall b813b95379 Prepare for Go 1.18 by replacing all our forked code (#549)
* Prepare for Go 1.18 by replacing all our forked code

This hides our forked-from-gotip code behind a build tag so it's only
used when the build is run on Go <1.18. For builds >= 1.18, we'll use
the actual runtime/debug and debug/buildinfo packages.

Add preliminary support for building on Go 1.18beta1 to our Build
matrix, to ensure this code builds. It's all a terrible hack, but it'll
get less so when 1.18 is actually released.

* Fix lint and boilerplate
2021-12-15 14:52:36 -05:00
Jason Hall 96bedf16df Add .ko.yaml to base ko container image on golang:1.17 (#533)
* Add .ko.yaml to base ko container image on golang:1.17

Ignore this in e2e tests, since even though golang:1.17 provides a
Windows base image, ko's base image platform selection doesn't take
osversion into account. The e2e tests don't exercise golang usage at
all, so it shouldn't matter.

* Update README
2021-12-14 12:56:21 -05:00
Jason Hallandjonjohnsonjr a8c0773790 Add a workflow to push a :latest ko image to ghcr.io (#528)
* Add a workflow to push a :latest ko image to ghcr.io

This also tags images with the commit SHA

* Update .github/workflows/image.yaml

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>

* Update .github/workflows/image.yaml

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>

* Update .github/workflows/image.yaml

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>
2021-12-09 13:51:28 -05:00
Jason Hall af2ff52a11 Generate ko deps in SPDX format (#507)
* WIP: generate ko deps in SPDX format

- copy out a bunch of BuildInfo stuff that will land in 1.18

* review comments

* have deps take --sbom flag more like Matt's new publish-time flag
2021-11-22 15:32:29 -05:00
Jason Hall 08fccaa789 Mention other tools that integrate with ko (#504) 2021-11-16 15:08:52 -05:00
Jason Hall 5617d1ebf8 Document /ko-app/ and entrypoint in README.md (#499) 2021-11-11 15:04:12 -05:00
Jason Hall 0015a81537 Enforce more lint checks, fix findings (#492) 2021-11-05 10:26:09 -07:00
Jason Hall 9821190605 Add e2e test for using ldflags to set a build-time variable (#480) 2021-11-02 17:36:05 -04:00
Jason Hall 17edbb3957 docs: Mention other deployment targets (#461) 2021-11-02 17:36:00 -04:00
Jason Hall 52d42d87a3 Document setup-ko in README.md (#484) 2021-11-02 17:35:50 -04:00
Jason Hall 1e46fdebd5 Use signal.NotifyContext and cmd.Context (#482) 2021-11-02 17:15:25 -04:00
Jason Hall 1e3c8ae940 Document ko publish in README (#469) 2021-10-09 18:01:21 -04:00
Jason Hall 6014fcda9a bump containerd dependency (#463) 2021-10-07 12:45:26 -04:00
Jason Hall 42723d75e7 Revert "Always produce OCI images and indexes (#449)" (#462)
This reverts commit 465eca2b93.

This breaks pushing to quay.io.
2021-10-06 07:15:52 -04:00
Jason Hall 465eca2b93 Always produce OCI images and indexes (#449)
* Always produce OCI images and indexes

* test each constituent manifest's mediatype
2021-10-05 11:58:31 -04:00
Jason Hall 729419aebb Add 'ko build' as a preferred alias for 'ko publish' (#456)
* Add 'ko build' as a preferred alias for 'ko publish'

* rm ko_publish.md
2021-10-05 08:48:57 -07:00
Jason Hall dde6c6dc9b Re-enable codeql analysis (#457) 2021-10-01 14:25:35 -04:00
Jason Hall 5ac3ef93f7 Clean filepath from zip before creating tempdir (#459) 2021-10-01 14:20:21 -04:00
Jason Hall b9cd759f25 Don't log the value of --password if given (#458) 2021-10-01 14:19:26 -04:00
Jason Hall 91077c8c5e Remove Travis badge (#452) 2021-09-29 08:52:34 -07:00
Jason Hall 2adcadd918 Fix regression in adding /ko-app to PATH (#448) 2021-09-27 11:00:25 -04:00
Jason Hall 5a8663b58d [ci] upgrade to Go 1.17 everywhere, clean up configs (#445)
* [ci] upgrade to go 1.17 everywhere

* remove unnecessary step names and shell:bash

gofmt with Go v1.17

* add boilerplate to hack/tools.go
2021-09-22 23:19:13 -04:00
Jason Hall 0451db7d0c drop special behavior to support Go pre-1.13 (#446) 2021-09-22 12:59:09 -04:00
Jason Hall 08c6c716f4 Use Go 1.16+ to release (#444) 2021-09-21 15:21:48 -04: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
Jason Hall 335c1ac8a6 Delete .travis.yml (#428) 2021-08-23 08:53:53 -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
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
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
Jason Hall c014ec1feb disable travis arm64 builds (#395) 2021-07-26 11:52:09 -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
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
Jason Hall 380705fd26 Document KIND_CLUSTER_NAME env var in README.md (#373) 2021-06-09 13:13:33 -04:00
Jason Hall 21728fdbb0 Fix typo in stale GitHub Action (#367) 2021-05-21 08:36:16 -07:00
Jason Hall 9814e6e0e4 Break free from Knative actions (#364) 2021-05-16 10:32:29 -04:00
Jason Hall 37aef60644 Remove GitHub Action (#352) 2021-04-29 14:44:34 -04:00
Jason Hall 5395f992fc bump ggcr dep to v0.5.0 (#349) 2021-04-28 18:08:12 -04:00
Jason Hall 938bbcdbd4 Add GitHub Action to install and setup ko (#347) 2021-04-28 16:20:08 -04:00
Jason Hall de98ea1b9c Build ko for Windows (#339)
Also explicitly build for macOS (darwin), I'm not sure how that was
being done before.
2021-04-28 11:58:06 -07:00
Jason Hall 29cd8e09e9 Use cobra's RunE wherever possible (#343) 2021-04-22 12:37:42 -04:00
Jason Hall 75ab99123d Plumb through context in kind.Tag and kind.Write (#341) 2021-04-20 15:46:17 -04:00
Jason Hall d498734556 Merge pull request #338 from mgiessing/main 2021-04-10 20:37:03 -04:00
Jason Hall 5eef982548 Merge pull request #313 from zhouhaibing089/update-bare-comment
options: update --bare help message
2021-04-07 20:50:16 -04:00
Jason Hall 0621cbac8e Update README.md 2021-04-07 20:49:26 -04:00
Jason Hall 866dcde0d4 Merge pull request #335 from google/ImJasonH-patch-1
Update README.md
2021-04-07 20:48:07 -04:00
Jason Hall d050647092 Update README.md 2021-04-01 09:45:59 -04:00
Jason Hall f5b79ffb0c Merge pull request #333 from knative-automation/auto-updates/common-actions
[Automated] Update actions
2021-04-01 09:41:17 -04:00
Jason Hall 1d9e8e7ff6 Merge pull request #334 from knative-automation/auto-updates/format-markdown
[Automated] Format markdown
2021-04-01 09:40:38 -04:00
Jason Hall abe1433980 Merge pull request #331 from ImJasonH/base-import-paths 2021-03-31 18:46:16 -04:00
Jason Hall c55c3fef24 Fix typo in README.md 2021-03-25 22:01:17 -04:00
Jason Hall 0b96f41240 Merge pull request #329 from knative-automation/auto-updates/common-actions
[Automated] Update actions
2021-03-18 10:27:16 -04:00
Jason Hall ee02868e32 Merge pull request #327 from knative-automation/auto-updates/common-actions
[Automated] Update actions
2021-03-11 08:49:24 -05:00
Jason Hall dd332573fa Merge pull request #326 from knative-automation/auto-updates/common-actions 2021-03-08 20:55:33 -05:00
Jason Hall f7df810619 Add --image-label to add labels to built images (#324) 2021-03-03 10:03:31 -08:00
Jason Hall c14c08e982 Merge pull request #312 from dprotaso/bump-deps
bump deps & drop replace directives
2021-02-26 11:34:36 -05:00
Jason Hall 8c33a4e3fe Merge pull request #322 from knative-automation/auto-updates/format-markdown 2021-02-25 21:31:18 -05:00
Jason Hall c0b2a1c3b5 Merge pull request #318 from ImJasonH/readme
Streamline README.md
2021-02-25 16:38:54 -05:00
Jason Hall 2863ff1b59 Streamline README.md 2021-02-24 10:06:22 -05:00
Jason Hall 4ad3f11f0b Merge pull request #306 from ImJasonH/rename 2021-02-19 00:17:34 -05:00
Jason Hall b8162cf14a Merge pull request #310 from knative-automation/auto-updates/common-actions
[Automated] Update actions
2021-02-10 20:50:32 -05:00
Jason Hall f25feecf2a Merge pull request #308 from knative-automation/auto-updates/common-actions
[Automated] Update actions
2021-02-04 09:11:37 -05:00
Jason Hall 746ec9019a Update travis link to main branch 2021-02-03 14:59:23 -05:00
Jason Hall 3c21033671 Merge pull request #302 from knative-automation/auto-updates/format-markdown
[Automated] Format markdown
2021-01-21 06:35:39 -05:00
Jason Hall 4372e2a482 Merge pull request #284 from knative-automation/auto-updates/common-actions 2021-01-20 21:45:31 -05:00