From b895251d30331aac86e62e6d2e44e31b5ddd049b Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 08:54:33 -0800 Subject: [PATCH 1/7] Move ko binary to root of project. --- README.md | 16 +++++----- cmd/ko/test/kodata/HEAD | 1 - cmd/ko/test/kodata/refs | 1 - hack/update-deps.sh | 5 +++ integration_test.sh | 2 +- ko.go | 49 +++++++++++++++++++++++++++++ pkg/build/gobuild_test.go | 24 +++++++------- pkg/publish/daemon_test.go | 4 +-- {cmd/ko/test => test}/kenobi | 0 test/kodata/HEAD | 1 + {cmd/ko/test => test}/kodata/kenobi | 0 test/kodata/refs | 1 + {cmd/ko/test => test}/main.go | 0 {cmd/ko/test => test}/test.yaml | 2 +- 14 files changed, 80 insertions(+), 26 deletions(-) delete mode 120000 cmd/ko/test/kodata/HEAD delete mode 120000 cmd/ko/test/kodata/refs create mode 100644 ko.go rename {cmd/ko/test => test}/kenobi (100%) create mode 120000 test/kodata/HEAD rename {cmd/ko/test => test}/kodata/kenobi (100%) create mode 120000 test/kodata/refs rename {cmd/ko/test => test}/main.go (100%) rename {cmd/ko/test => test}/test.yaml (93%) diff --git a/README.md b/README.md index 56d73b7557..caa6b475ca 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ **Note**: Golang version `1.12.0` or higher is required. ```shell -GO111MODULE=on go get github.com/google/ko/cmd/ko +GO111MODULE=on go get github.com/google/ko ``` ## Authenticating @@ -49,7 +49,7 @@ like `github.com/google/ko/cmd`. **One of the goals of `ko` is to make containers invisible infrastructure.** Simply replace image references in your Kubernetes yaml with the import path for -your Go binary prefixed with `ko://` (e.g. `ko://github.com/google/ko/cmd/ko`), +your Go binary prefixed with `ko://` (e.g. `ko://github.com/google/ko/test`), and `ko` will handle containerizing and publishing that container image as needed. @@ -409,7 +409,7 @@ for referencing them should be through the `KO_DATA_PATH` environment variable. The intent of this is to enable users to test things outside of `ko` as follows: ```shell -KO_DATA_PATH=$PWD/cmd/ko/test/kodata go run ./cmd/ko/test/*.go +KO_DATA_PATH=$PWD/test/kodata go run ./test/*.go 2018/07/19 23:35:20 Hello there ``` @@ -417,18 +417,18 @@ This produces identical output to being run within the container locally: ```shell ko publish -L ./cmd/test -2018/07/19 23:36:11 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/cmd/test -2018/07/19 23:36:12 Loading ko.local/github.com/google/ko/cmd/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 -2018/07/19 23:36:13 Loaded ko.local/github.com/google/ko/cmd/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 +2018/07/19 23:36:11 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/test +2018/07/19 23:36:12 Loading ko.local/github.com/google/ko/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 +2018/07/19 23:36:13 Loaded ko.local/github.com/google/ko/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 -docker run -ti --rm ko.local/github.com/google/ko/cmd/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 +docker run -ti --rm ko.local/github.com/google/ko/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 2018/07/19 23:36:25 Hello there ``` ... or on cluster: ```shell -ko apply -f cmd/ko/test/test.yaml +ko apply -f test/test.yaml 2018/07/19 23:38:24 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/cmd/test 2018/07/19 23:38:25 Publishing us.gcr.io/my-project/test-294a7bdc57d85dc6ddeef5ba38a59fe9:latest 2018/07/19 23:38:26 mounted blob: sha256:988abcba36b5948da8baa1e3616b94c0b56da814b8f6ff3ae3ac316e375e093a diff --git a/cmd/ko/test/kodata/HEAD b/cmd/ko/test/kodata/HEAD deleted file mode 120000 index 481bd4eff4..0000000000 --- a/cmd/ko/test/kodata/HEAD +++ /dev/null @@ -1 +0,0 @@ -../../../../.git/HEAD \ No newline at end of file diff --git a/cmd/ko/test/kodata/refs b/cmd/ko/test/kodata/refs deleted file mode 120000 index fe164fe40f..0000000000 --- a/cmd/ko/test/kodata/refs +++ /dev/null @@ -1 +0,0 @@ -../../../../.git/refs \ No newline at end of file diff --git a/hack/update-deps.sh b/hack/update-deps.sh index 25be8103ef..cb4871e9cb 100755 --- a/hack/update-deps.sh +++ b/hack/update-deps.sh @@ -29,3 +29,8 @@ go mod vendor # Delete all vendored broken symlinks. # From https://stackoverflow.com/questions/22097130/delete-all-broken-symbolic-links-with-a-line find vendor/ -type l -exec sh -c 'for x; do [ -e "$x" ] || rm "$x"; done' _ {} + + + +# HACK HACK HACK: +# Until we can cleanly remove it, copy root ko.go and move it to ./cmd/ko +cp ${PROJECT_ROOT}/ko.go ${PROJECT_ROOT}/cmd/ko/main.go diff --git a/integration_test.sh b/integration_test.sh index e0e15aa9de..65ede2947e 100755 --- a/integration_test.sh +++ b/integration_test.sh @@ -29,7 +29,7 @@ sed -i 's/Hello World/TEST/g' ./vendor/github.com/go-training/helloworld/main.go echo "Building ko" -RESULT="$(GO111MODULE="on" GOFLAGS="-mod=vendor" go build ./cmd/ko)" +RESULT="$(GO111MODULE="on" GOFLAGS="-mod=vendor" go build .)" echo "Beginning scenarios." diff --git a/ko.go b/ko.go new file mode 100644 index 0000000000..2e85db545a --- /dev/null +++ b/ko.go @@ -0,0 +1,49 @@ +// Copyright 2018 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "log" + "os" + + "github.com/google/go-containerregistry/pkg/logs" + "github.com/google/ko/pkg/commands" + + cranecmd "github.com/google/go-containerregistry/cmd/crane/cmd" + "github.com/spf13/cobra" +) + +func main() { + logs.Warn.SetOutput(os.Stderr) + logs.Progress.SetOutput(os.Stderr) + + // Parent command to which all subcommands are added. + cmds := &cobra.Command{ + Use: "ko", + Short: "Rapidly iterate with Go, Containers, and Kubernetes.", + Run: func(cmd *cobra.Command, args []string) { + cmd.Help() + }, + } + commands.AddKubeCommands(cmds) + + // Also add the auth group from crane to facilitate logging into a + // registry. + cmds.AddCommand(cranecmd.NewCmdAuth()) + + if err := cmds.Execute(); err != nil { + log.Fatalf("error during command execution: %v", err) + } +} diff --git a/pkg/build/gobuild_test.go b/pkg/build/gobuild_test.go index 61a00b159d..fd04bd455d 100644 --- a/pkg/build/gobuild_test.go +++ b/pkg/build/gobuild_test.go @@ -46,7 +46,7 @@ func TestGoBuildIsSupportedRef(t *testing.T) { // Supported import paths. for _, importpath := range []string{ - "ko://github.com/google/ko/cmd/ko", // ko can build itself. + "ko://github.com/google/ko", // ko can build itself. } { t.Run(importpath, func(t *testing.T) { if err := ng.IsSupportedReference(importpath); err != nil { @@ -76,7 +76,7 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { mods := &modules{ main: &modInfo{ - Path: "github.com/google/ko/cmd/ko/test", + Path: "github.com/google/ko/test", Dir: ".", }, deps: map[string]*modInfo{ @@ -92,7 +92,7 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { withModuleInfo(mods), withBuildContext(stubBuildContext{ // make all referenced deps commands - "github.com/google/ko/cmd/ko/test": &gb.Package{Name: "main"}, + "github.com/google/ko/test": &gb.Package{Name: "main"}, "github.com/some/module/cmd": &gb.Package{Name: "main"}, "github.com/google/ko/pkg/build": &gb.Package{Name: "build"}, @@ -106,7 +106,7 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { // Supported import paths. for _, importpath := range []string{ - "ko://github.com/google/ko/cmd/ko/test", // ko can build the test package. + "ko://github.com/google/ko/test", // ko can build the test package. "ko://github.com/some/module/cmd", // ko can build commands in dependent modules } { t.Run(importpath, func(t *testing.T) { @@ -120,7 +120,7 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { for _, importpath := range []string{ "ko://github.com/google/ko/pkg/build", // not a command. "ko://github.com/google/ko/pkg/nonexistent", // does not exist. - "ko://github.com/google/ko/cmd/ko", // not in this module. + "ko://github.com/google/ko", // not in this module. } { t.Run(importpath, func(t *testing.T) { if err := ng.IsSupportedReference(importpath); err == nil { @@ -166,7 +166,7 @@ func TestGoBuildNoKoData(t *testing.T) { t.Fatalf("NewGo() = %v", err) } - result, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko")) + result, err := ng.Build(context.Background(), StrictScheme+importpath) if err != nil { t.Fatalf("Build() = %v", err) } @@ -191,7 +191,7 @@ func TestGoBuildNoKoData(t *testing.T) { // Check that rebuilding the image again results in the same image digest. t.Run("check determinism", func(t *testing.T) { - result2, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko")) + result2, err := ng.Build(context.Background(), StrictScheme+importpath) if err != nil { t.Fatalf("Build() = %v", err) } @@ -407,7 +407,7 @@ func TestGoBuild(t *testing.T) { t.Fatalf("NewGo() = %v", err) } - result, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko", "test")) + result, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test")) if err != nil { t.Fatalf("Build() = %v", err) } @@ -421,7 +421,7 @@ func TestGoBuild(t *testing.T) { // Check that rebuilding the image again results in the same image digest. t.Run("check determinism", func(t *testing.T) { - result2, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko", "test")) + result2, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test")) if err != nil { t.Fatalf("Build() = %v", err) } @@ -461,7 +461,7 @@ func TestGoBuildIndex(t *testing.T) { t.Fatalf("NewGo() = %v", err) } - result, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko", "test")) + result, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test")) if err != nil { t.Fatalf("Build() = %v", err) } @@ -490,7 +490,7 @@ func TestGoBuildIndex(t *testing.T) { // Check that rebuilding the image again results in the same image digest. t.Run("check determinism", func(t *testing.T) { - result2, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko", "test")) + result2, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test")) if err != nil { t.Fatalf("Build() = %v", err) } @@ -531,7 +531,7 @@ func TestNestedIndex(t *testing.T) { t.Fatalf("NewGo() = %v", err) } - _, err = ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "cmd", "ko", "test")) + _, err = ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test")) if err == nil { t.Fatal("Build() expected err") } diff --git a/pkg/publish/daemon_test.go b/pkg/publish/daemon_test.go index e6b9d223ef..e01d3d5187 100644 --- a/pkg/publish/daemon_test.go +++ b/pkg/publish/daemon_test.go @@ -48,7 +48,7 @@ func init() { } func TestDaemon(t *testing.T) { - importpath := "github.com/google/ko/cmd/ko" + importpath := "github.com/google/ko" img, err := random.Image(1024, 1) if err != nil { t.Fatalf("random.Image() = %v", err) @@ -65,7 +65,7 @@ func TestDaemon(t *testing.T) { func TestDaemonTags(t *testing.T) { Tags = nil - importpath := "github.com/google/ko/cmd/ko" + importpath := "github.com/google/ko" img, err := random.Image(1024, 1) if err != nil { t.Fatalf("random.Image() = %v", err) diff --git a/cmd/ko/test/kenobi b/test/kenobi similarity index 100% rename from cmd/ko/test/kenobi rename to test/kenobi diff --git a/test/kodata/HEAD b/test/kodata/HEAD new file mode 120000 index 0000000000..68ad874ce5 --- /dev/null +++ b/test/kodata/HEAD @@ -0,0 +1 @@ +../../.git/HEAD \ No newline at end of file diff --git a/cmd/ko/test/kodata/kenobi b/test/kodata/kenobi similarity index 100% rename from cmd/ko/test/kodata/kenobi rename to test/kodata/kenobi diff --git a/test/kodata/refs b/test/kodata/refs new file mode 120000 index 0000000000..dcbeeb0065 --- /dev/null +++ b/test/kodata/refs @@ -0,0 +1 @@ +../../.git/refs \ No newline at end of file diff --git a/cmd/ko/test/main.go b/test/main.go similarity index 100% rename from cmd/ko/test/main.go rename to test/main.go diff --git a/cmd/ko/test/test.yaml b/test/test.yaml similarity index 93% rename from cmd/ko/test/test.yaml rename to test/test.yaml index 462345446d..717402a1d4 100644 --- a/cmd/ko/test/test.yaml +++ b/test/test.yaml @@ -18,5 +18,5 @@ metadata: spec: containers: - name: obiwan - image: ko://github.com/google/ko/cmd/ko/test + image: ko://github.com/google/ko/test restartPolicy: Never From 48d611665cc13bc34f1212d4571dcfb178638251 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 09:30:02 -0800 Subject: [PATCH 2/7] go.mod says required golang version is 1.14 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index caa6b475ca..ddce6e8aec 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@ `ko` can be installed and upgraded by running: -**Note**: Golang version `1.12.0` or higher is required. +**Note**: Golang version `1.14.0` or higher is required. ```shell -GO111MODULE=on go get github.com/google/ko +go get github.com/google/ko ``` ## Authenticating From a5a6bdca6f9559ceef5573f91988826ea30f6214 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 09:42:59 -0800 Subject: [PATCH 3/7] go install uses the folder name --- hack/update-deps.sh | 4 ++-- ko.go => main.go | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename ko.go => main.go (100%) diff --git a/hack/update-deps.sh b/hack/update-deps.sh index cb4871e9cb..0fb575da8e 100755 --- a/hack/update-deps.sh +++ b/hack/update-deps.sh @@ -32,5 +32,5 @@ find vendor/ -type l -exec sh -c 'for x; do [ -e "$x" ] || rm "$x"; done' _ {} + # HACK HACK HACK: -# Until we can cleanly remove it, copy root ko.go and move it to ./cmd/ko -cp ${PROJECT_ROOT}/ko.go ${PROJECT_ROOT}/cmd/ko/main.go +# Until we can cleanly remove it, copy root main.go and move it to ./cmd/ko +cp ${PROJECT_ROOT}/main.go ${PROJECT_ROOT}/cmd/ko/ diff --git a/ko.go b/main.go similarity index 100% rename from ko.go rename to main.go From 179df88f091549bd1f9793bc3199d5b406d957ce Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 09:47:38 -0800 Subject: [PATCH 4/7] lint and copyright bump --- main.go | 36 +++++++++++++++++++----------------- pkg/build/gobuild_test.go | 10 +++++----- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/main.go b/main.go index 2e85db545a..1f37fa0971 100644 --- a/main.go +++ b/main.go @@ -1,16 +1,18 @@ -// Copyright 2018 Google LLC All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* +Copyright 2020 Google LLC All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ package main @@ -18,11 +20,11 @@ import ( "log" "os" - "github.com/google/go-containerregistry/pkg/logs" - "github.com/google/ko/pkg/commands" - cranecmd "github.com/google/go-containerregistry/cmd/crane/cmd" + "github.com/google/go-containerregistry/pkg/logs" "github.com/spf13/cobra" + + "github.com/google/ko/pkg/commands" ) func main() { @@ -44,6 +46,6 @@ func main() { cmds.AddCommand(cranecmd.NewCmdAuth()) if err := cmds.Execute(); err != nil { - log.Fatalf("error during command execution: %v", err) + log.Fatal("error during command execution:", err) } } diff --git a/pkg/build/gobuild_test.go b/pkg/build/gobuild_test.go index fd04bd455d..5c5a0131ca 100644 --- a/pkg/build/gobuild_test.go +++ b/pkg/build/gobuild_test.go @@ -92,8 +92,8 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { withModuleInfo(mods), withBuildContext(stubBuildContext{ // make all referenced deps commands - "github.com/google/ko/test": &gb.Package{Name: "main"}, - "github.com/some/module/cmd": &gb.Package{Name: "main"}, + "github.com/google/ko/test": &gb.Package{Name: "main"}, + "github.com/some/module/cmd": &gb.Package{Name: "main"}, "github.com/google/ko/pkg/build": &gb.Package{Name: "build"}, }), @@ -106,8 +106,8 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { // Supported import paths. for _, importpath := range []string{ - "ko://github.com/google/ko/test", // ko can build the test package. - "ko://github.com/some/module/cmd", // ko can build commands in dependent modules + "ko://github.com/google/ko/test", // ko can build the test package. + "ko://github.com/some/module/cmd", // ko can build commands in dependent modules } { t.Run(importpath, func(t *testing.T) { if err := ng.IsSupportedReference(importpath); err != nil { @@ -120,7 +120,7 @@ func TestGoBuildIsSupportedRefWithModules(t *testing.T) { for _, importpath := range []string{ "ko://github.com/google/ko/pkg/build", // not a command. "ko://github.com/google/ko/pkg/nonexistent", // does not exist. - "ko://github.com/google/ko", // not in this module. + "ko://github.com/google/ko", // not in this module. } { t.Run(importpath, func(t *testing.T) { if err := ng.IsSupportedReference(importpath); err == nil { From 67bc0e2f4858992306aa456d82072fd7fdffa1e5 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 09:55:58 -0800 Subject: [PATCH 5/7] moving the test file changed the test hash. --- pkg/publish/daemon_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/publish/daemon_test.go b/pkg/publish/daemon_test.go index e01d3d5187..ccc2528dac 100644 --- a/pkg/publish/daemon_test.go +++ b/pkg/publish/daemon_test.go @@ -78,7 +78,7 @@ func TestDaemonTags(t *testing.T) { t.Errorf("Publish() = %v, wanted prefix %v", got, want) } - expected := []string{"ko.local/099ba5bcefdead87f92606265fb99ac0:v2.0.0", "ko.local/099ba5bcefdead87f92606265fb99ac0:v1.2.3", "ko.local/099ba5bcefdead87f92606265fb99ac0:production"} + expected := []string{"ko.local/98b8c7facdad74510a7cae0cd368eb4e:v2.0.0", "ko.local/98b8c7facdad74510a7cae0cd368eb4e:v1.2.3", "ko.local/98b8c7facdad74510a7cae0cd368eb4e:production"} for i, v := range expected { if Tags[i] != v { From 6614d58f904054af01d53729a9ef7a1644672b89 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 10:10:00 -0800 Subject: [PATCH 6/7] more refs of cmd/test --- .github/workflows/kind-e2e.yaml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kind-e2e.yaml b/.github/workflows/kind-e2e.yaml index 729f227228..f95ccb8c9d 100644 --- a/.github/workflows/kind-e2e.yaml +++ b/.github/workflows/kind-e2e.yaml @@ -136,7 +136,7 @@ jobs: kubectl delete pod kodata # Test with registry - ko apply --platform=all -f ./cmd/ko/test + ko apply --platform=all -f ./test kubectl wait --timeout=60s --for=condition=Ready pod/kodata kubectl delete pod kodata diff --git a/README.md b/README.md index ddce6e8aec..b6885a1ff8 100644 --- a/README.md +++ b/README.md @@ -416,7 +416,7 @@ KO_DATA_PATH=$PWD/test/kodata go run ./test/*.go This produces identical output to being run within the container locally: ```shell -ko publish -L ./cmd/test +ko publish -L ./test 2018/07/19 23:36:11 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/test 2018/07/19 23:36:12 Loading ko.local/github.com/google/ko/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 2018/07/19 23:36:13 Loaded ko.local/github.com/google/ko/test:703c205bf2f405af520b40536b87aafadcf181562b8faa6690fd2992084c8577 @@ -429,7 +429,7 @@ docker run -ti --rm ko.local/github.com/google/ko/test:703c205bf2f405af520b40536 ```shell ko apply -f test/test.yaml -2018/07/19 23:38:24 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/cmd/test +2018/07/19 23:38:24 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/test 2018/07/19 23:38:25 Publishing us.gcr.io/my-project/test-294a7bdc57d85dc6ddeef5ba38a59fe9:latest 2018/07/19 23:38:26 mounted blob: sha256:988abcba36b5948da8baa1e3616b94c0b56da814b8f6ff3ae3ac316e375e093a 2018/07/19 23:38:26 mounted blob: sha256:57752e7f9593cbfb7101af994b136a369ecc8174332866622db32a264f3fbefd From 645669dc2eae6eaee65ee526b9fd76083280fe60 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Fri, 4 Dec 2020 10:56:06 -0800 Subject: [PATCH 7/7] add deprecation message --- .github/workflows/kind-e2e.yaml | 2 +- cmd/ko/main.go | 15 +++++++++++++++ hack/update-deps.sh | 4 ---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/kind-e2e.yaml b/.github/workflows/kind-e2e.yaml index f95ccb8c9d..5429b1c026 100644 --- a/.github/workflows/kind-e2e.yaml +++ b/.github/workflows/kind-e2e.yaml @@ -131,7 +131,7 @@ jobs: - name: Run Smoke Test run: | # Test with kind load - KO_DOCKER_REPO=kind.local ko apply --platform=all -f ./cmd/ko/test + KO_DOCKER_REPO=kind.local ko apply --platform=all -f ./test kubectl wait --timeout=10s --for=condition=Ready pod/kodata kubectl delete pod kodata diff --git a/cmd/ko/main.go b/cmd/ko/main.go index 2e85db545a..ab26edf868 100644 --- a/cmd/ko/main.go +++ b/cmd/ko/main.go @@ -14,6 +14,10 @@ package main +// HEY! YOU! This file has moved to the root of the project. +// !! PLEASE DO NOT ADD NEW FEATURES HERE !! +// Only sync with the root/main.go. + import ( "log" "os" @@ -25,6 +29,15 @@ import ( "github.com/spf13/cobra" ) +const Deprecation258 = `NOTICE! +----------------------------------------------------------------- +Please install ko from github.com/google/ko. + +For more information see: + https://github.com/google/ko/issues/258 +----------------------------------------------------------------- +` + func main() { logs.Warn.SetOutput(os.Stderr) logs.Progress.SetOutput(os.Stderr) @@ -43,6 +56,8 @@ func main() { // registry. cmds.AddCommand(cranecmd.NewCmdAuth()) + log.Print(Deprecation258) + if err := cmds.Execute(); err != nil { log.Fatalf("error during command execution: %v", err) } diff --git a/hack/update-deps.sh b/hack/update-deps.sh index 0fb575da8e..cb928175c7 100755 --- a/hack/update-deps.sh +++ b/hack/update-deps.sh @@ -30,7 +30,3 @@ go mod vendor # From https://stackoverflow.com/questions/22097130/delete-all-broken-symbolic-links-with-a-line find vendor/ -type l -exec sh -c 'for x; do [ -e "$x" ] || rm "$x"; done' _ {} + - -# HACK HACK HACK: -# Until we can cleanly remove it, copy root main.go and move it to ./cmd/ko -cp ${PROJECT_ROOT}/main.go ${PROJECT_ROOT}/cmd/ko/