-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move ko binary to root of project. #257
Changes from 6 commits
b895251
48d6116
a5a6bdc
179df88
67bc0e2
6614d58
645669d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/cmd/ko | ||
go get github.com/google/ko | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should we do for users that install from cmd/ko today in scripts? This change would break them without a lot of help about what changed or how to fix it. Can we keep cmd/ko/main.go as an alias for a release or two with a deprecation warning? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was always my plan to keep both. We have a lot of tooling that hardcodes installing ko from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It never broke them, I left There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did drop |
||
``` | ||
|
||
## 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,27 +409,27 @@ 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 | ||
``` | ||
|
||
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 | ||
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 | ||
|
||
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 | ||
2018/07/19 23:38:24 Using base gcr.io/distroless/static:nonroot for github.com/google/ko/cmd/test | ||
ko apply -f test/test.yaml | ||
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 | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 main.go and move it to ./cmd/ko | ||
cp ${PROJECT_ROOT}/main.go ${PROJECT_ROOT}/cmd/ko/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to just commit a symlink to the root? Or would that break everything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed this 😇 I'd prefer something explicit since it also gives us an opportunity to inject a deprecation warning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a message, dropped the copy, |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
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 | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
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() { | ||
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.Fatal("error during command execution:", err) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.git/HEAD |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.git/refs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is 1.14 required now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is what the go mod file says.