From bf7187652bb339c30df565c9fbc4efc92b0eb49f Mon Sep 17 00:00:00 2001 From: Matthew Fenwick Date: Tue, 28 Jul 2020 13:18:20 -0400 Subject: [PATCH] add build/release instructions --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++- deploy/krew/plugin.yaml | 20 +++++++++--------- pkg/cli/root.go | 3 +++ 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ab00980..d098895 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # node-pod kubectl -A `kubectl` plugin to ... +A `kubectl` plugin to show the assignment of pods to nodes. ## Quick Start @@ -9,3 +9,46 @@ kubectl krew install node-pod kubectl node-pod ``` +# How to release + +See https://goreleaser.com/quick-start/ + +Set up a github token and run: + +``` +VERSION=v9.9.9 +git tag $VERSION -m "something about the version" +git push --tags + +export GITHUB_TOKEN=... + +goreleaser +``` + +In [the plugin.yaml file](./deploy/krew/plugin.yaml): + - manually update the sha256's using [the checksums file](https://github.com/mattfenwick/krew-node-pod/releases/download/v0.0.3/node-pod_0.0.3_checksums.txt) + - **TODO** is there a better way to do this? + - manually update the versions using [the checksums file](https://github.com/mattfenwick/krew-node-pod/releases/download/v0.0.3/node-pod_0.0.3_checksums.txt) + - **TODO** is there a better way to do this? + +# How to test a local release + +1. download a binary from [the github project release page](https://github.com/mattfenwick/krew-node-pod/releases/tag/v0.0.3) + +2. run a `krew install` against the downloaded binary + + ``` + kubectl krew install --manifest=./deploy/krew/plugin.yaml --archive=/Users/mfenwick/Downloads/node-pod_darwin_amd64.tar.gz + ``` + +3. test it + + ``` + kubectl node-pod + ``` + +4. clean up + + ``` + kubectl krew uninstall node-pod + ``` \ No newline at end of file diff --git a/deploy/krew/plugin.yaml b/deploy/krew/plugin.yaml index c092f2b..e763b74 100644 --- a/deploy/krew/plugin.yaml +++ b/deploy/krew/plugin.yaml @@ -3,14 +3,14 @@ kind: Plugin metadata: name: node-pod spec: - version: "v0.1.0" + version: "v0.0.3" platforms: - selector: matchLabels: os: linux arch: amd64 - uri: https://github.com/mattfenwick/krew-node-pod/releases/download/v0.1.0/node-pod_linux_amd64.tar.gz - sha256: "" + uri: https://github.com/mattfenwick/krew-node-pod/releases/download/v0.0.3/node-pod_linux_amd64.tar.gz + sha256: "d4072e0a9435dbed7075e8cb478741ab7d24e6184cefec6a865d7f782b2d2fc7" files: - from: "./node-pod" to: "." @@ -21,8 +21,8 @@ spec: matchLabels: os: darwin arch: amd64 - uri: https://github.com/mattfenwick/krew-node-pod/releases/download/v0.1.0/node-pod_darwin_amd64.tar.gz - sha256: "" + uri: https://github.com/mattfenwick/krew-node-pod/releases/download/v0.0.3/node-pod_darwin_amd64.tar.gz + sha256: "42f32d1d029a5c0f898fee27a3049213392caf83fd3be5f93364685388e44295" files: - from: "./node-pod" to: "." @@ -33,15 +33,15 @@ spec: matchLabels: os: windows arch: amd64 - uri: https://github.com/mattfenwick/krew-node-pod/releases/download/v0.1.0/node-pod_windows_amd64.zip - sha256: "" + uri: https://github.com/mattfenwick/krew-node-pod/releases/download/v0.0.3/node-pod_windows_amd64.zip + sha256: "b85d4e550946a053801bce0c208c1afc47109c0ab6e17d86efd9727d37a942b9" files: - from: "/node-pod.exe" to: "." - from: LICENSE to: "." bin: "node-pod.exe" - shortDescription: A new plugin + shortDescription: Shows assignment of pods to nodes. homepage: https://github.com/mattfenwick/krew-node-pod caveats: | Usage: @@ -49,7 +49,7 @@ spec: For additional options: $ kubectl node-pod --help - or https://github.com/mattfenwick/krew-node-pod/blob/v0.1.0/doc/USAGE.md + or https://github.com/mattfenwick/krew-node-pod/blob/v0.0.3/doc/USAGE.md description: | - This is a new plugin + This plugin shows the assignment of pods to nodes. diff --git a/pkg/cli/root.go b/pkg/cli/root.go index a2e268a..0190946 100644 --- a/pkg/cli/root.go +++ b/pkg/cli/root.go @@ -41,6 +41,9 @@ func setupRootCmd() *cobra.Command { SilenceErrors: true, SilenceUsage: true, RunE: func(cmd *cobra.Command, as []string) error { + // TODO detect whether this is running under kubectl or not, and modify help message accordingly + // see https://krew.sigs.k8s.io/docs/developer-guide/develop/best-practices/#auth-plugins + // if strings.HasPrefix(filepath.Base(os.Args[0]), "kubectl-") { } runRootCmd(args) return nil },