Skip to content

Commit

Permalink
Fixes #4 #6
Browse files Browse the repository at this point in the history
- Add release binary for Apple Silicon arch
  • Loading branch information
ulucinar committed May 1, 2021
1 parent 37b654f commit 1903e64
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ builds:
- darwin
goarch:
- amd64
- arm64
# https://goreleaser.com/customization/archive/
archives:
# https://goreleaser.com/customization/templates/
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ bin-windows: kubectl-edit_status-windows
archives: bin-darwin bin-linux bin-windows

krew:
$(eval SHA_DARWIN := $(shell sha256sum dist/$(PROJECT_NAME)_$(TAG)_darwin_amd64.tar.gz | cut -d' ' -f1))
$(eval SHA_LINUX := $(shell sha256sum dist/$(PROJECT_NAME)_$(TAG)_linux_amd64.tar.gz | cut -d' ' -f1))
$(eval SHA_WINDOWS := $(shell sha256sum dist/$(PROJECT_NAME)_$(TAG)_windows_amd64.tar.gz | cut -d' ' -f1))
$(shell cat krew/edit-status.yaml.template | SHA_DARWIN=$(SHA_DARWIN) SHA_LINUX=$(SHA_LINUX) SHA_WINDOWS=$(SHA_WINDOWS) TAG=$(TAG) PLUGIN_BINARY=$(PLUGIN_BINARY) PROJECT_NAME=$(PROJECT_NAME) envsubst > plugins/edit-status.yaml)
KREW_COMMIT=$(KREW_COMMIT) TAG=$(TAG) krew/commit_krew_manifest.sh
KREW_COMMIT=$(KREW_COMMIT) TAG=$(TAG) PLUGIN_BINARY=$(PLUGIN_BINARY) PROJECT_NAME=$(PROJECT_NAME) krew/prepare_krew_manifest.sh

clean:
rm -fR dist
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ With the current plugin mechanism of `kubectl`, it's currently not possible to e
so this plugin adds a new command (`edit-status`) to `kubectl`.

## Installation
You can use [krew](https://krew.sigs.k8s.io/) to install `edit-status`. If you have not installed `krew` yet, which itself is a `kubectl` plugin,
you may do so by following `krew`'s [installation instructions](https://krew.sigs.k8s.io/docs/user-guide/setup/install/).
`edit-status` is not yet available through `krew`'s [default index](https://github.com/kubernetes-sigs/krew-index),
and this repository also acts as a [custom plugin index](https://krew.sigs.k8s.io/docs/developer-guide/custom-indexes/).
In order to install `edit-status`:
You can use [krew](https://krew.sigs.k8s.io/) to install `edit-status`. If you have not installed `krew` yet, which itself is a `kubectl` plugin,
you may do so by following `krew`'s [installation instructions](https://krew.sigs.k8s.io/docs/user-guide/setup/install/).
`edit-status` is available through `krew`'s [default index](https://github.com/kubernetes-sigs/krew-index):
- Update plugin index: <br />
`kubectl krew update`
- Install `edit-status` plugin: <br />
`kubectl krew install edit-status`
- If you have not done yet so, `krew` plugin binary directory (e.g., `${HOME}/.krew/bin`) should be on your `PATH`


## Installation by Using This Repo as a Custom Plugin Index

This repository also acts as a [custom plugin index](https://krew.sigs.k8s.io/docs/developer-guide/custom-indexes/).
In order to install `edit-status` using this repo as a custom plugin index:
- Please make sure that your `krew` plugin supports custom plugin indexes (version [`0.4.0`](https://github.com/kubernetes-sigs/krew/releases/tag/v0.4.0) or higher).
- Add this repository as a custom plugin index that indexes just one plugin as of right now: <br />
`kubectl krew index add edit-status https://github.com/ulucinar/kubectl-edit-status`
Expand Down
135 changes: 135 additions & 0 deletions go.sum

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions krew/edit-status.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ spec:
os: darwin
arch: amd64
uri: https://github.com/ulucinar/kubectl-edit-status/releases/download/${TAG}/${PROJECT_NAME}_${TAG}_darwin_amd64.tar.gz
sha256: ${SHA_DARWIN}
sha256: ${SHA_DARWIN_AMD64}
files:
- from: "*"
to: "."
bin: ${PLUGIN_BINARY}
- selector:
matchLabels:
os: darwin
arch: arm64
uri: https://github.com/ulucinar/kubectl-edit-status/releases/download/${TAG}/${PROJECT_NAME}_${TAG}_darwin_arm64.tar.gz
sha256: ${SHA_DARWIN_ARM64}
files:
- from: "*"
to: "."
Expand All @@ -30,7 +40,7 @@ spec:
os: linux
arch: amd64
uri: https://github.com/ulucinar/kubectl-edit-status/releases/download/${TAG}/${PROJECT_NAME}_${TAG}_linux_amd64.tar.gz
sha256: ${SHA_LINUX}
sha256: ${SHA_LINUX_AMD64}
files:
- from: "*"
to: "."
Expand All @@ -40,7 +50,7 @@ spec:
os: windows
arch: amd64
uri: https://github.com/ulucinar/kubectl-edit-status/releases/download/${TAG}/${PROJECT_NAME}_${TAG}_windows_amd64.tar.gz
sha256: ${SHA_WINDOWS}
sha256: ${SHA_WINDOWS_AMD64}
files:
- from: "*"
to: "."
Expand Down
29 changes: 29 additions & 0 deletions krew/prepare_krew_manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# HO.

# Copyright © 2021 Alper Rifat Ulucinar
#
# 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.

set -euxo pipefail

export SHA_DARWIN_AMD64="$(sha256sum "dist/${PROJECT_NAME}_${TAG}_darwin_amd64.tar.gz" | cut -d' ' -f1)"
export SHA_DARWIN_ARM64="$(sha256sum "dist/${PROJECT_NAME}_${TAG}_darwin_arm64.tar.gz" | cut -d' ' -f1)"
export SHA_LINUX_AMD64="$(sha256sum "dist/${PROJECT_NAME}_${TAG}_linux_amd64.tar.gz" | cut -d' ' -f1)"
export SHA_WINDOWS_AMD64="$(sha256sum "dist/${PROJECT_NAME}_${TAG}_windows_amd64.tar.gz" | cut -d' ' -f1)"

# prepare krew plugin manifest
envsubst < krew/edit-status.yaml.template > plugins/edit-status.yaml
# commit krew plugin manifest if requested
krew/commit_krew_manifest.sh

0 comments on commit 1903e64

Please sign in to comment.