Skip to content

Commit

Permalink
Merge pull request #2 from dodevops/feature/dpr/krew-release
Browse files Browse the repository at this point in the history
feat: Adds krew manifest generation
  • Loading branch information
dploeger authored Oct 8, 2024
2 parents eb95a2e + 0fa9f33 commit ead19ad
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ jobs:
go-version: "1.23"

- name: Build
run: go build -o kc cmd/kc.go
run: go build -o kubectl-cs cmd/kubectl-cs.go

- name: Release file
- name: Package file
run: |
rm kubectl-cs.tar.gz &>/dev/null
tar czf kubectl-cs.tar.gz kubectl-cs LICENSE
- name: Release
uses: djnicholson/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-name: ${{ github.event.release.name }}
tag-name: ${{ github.event.release.tag_name }}
asset-name: kc-${{ matrix.goos }}-${{ matrix.goarch }}
file: kc
asset-name: kubectl-cs-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
file: kubectl-cs.tar.gz

- name: Update new version in krew-index
uses: rajatjindal/[email protected]
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ jobs:
cache: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: "--timeout 5m"
60 changes: 60 additions & 0 deletions .krew.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: cs
spec:
version: {{ .TagName }}
homepage: https://github.com/dodevops/kc
platforms:
- selector:
matchLabels:
os: darwin
arch: amd64
{{addURIAndSha "https://github.com/dodevops/kc/releases/download/{{ .TagName }}/kubectl-cs-darwin-amd64.tar.gz" .TagName }}
bin: kubectl-cs
- selector:
matchLabels:
os: darwin
arch: arm64
{{addURIAndSha "https://github.com/dodevops/kc/releases/download/{{ .TagName }}/kubectl-cs-darwin-arm64.tar.gz" .TagName }}
bin: kubectl-cs
- selector:
matchLabels:
os: windows
arch: amd64
{{addURIAndSha "https://github.com/dodevops/kc/releases/download/{{ .TagName }}/kubectl-cs-windows-amd64.tar.gz" .TagName }}
bin: kubectl-cs
- selector:
matchLabels:
os: windows
arch: arm64
{{addURIAndSha "https://github.com/dodevops/kc/releases/download/{{ .TagName }}/kubectl-cs-windows-arm64.tar.gz" .TagName }}
bin: kubectl-cs
- selector:
matchLabels:
os: linux
arch: amd64
{{addURIAndSha "https://github.com/dodevops/kc/releases/download/{{ .TagName }}/kubectl-cs-linux-amd64.tar.gz" .TagName }}
bin: kubectl-cs
- selector:
matchLabels:
os: linux
arch: arm64
{{addURIAndSha "https://github.com/dodevops/kc/releases/download/{{ .TagName }}/kubectl-cs-linux-arm64.tar.gz" .TagName }}
bin: kubectl-cs
shortDescription: Quick Kubernetes context switcher
description: |
Usage:
kubectl cs [--only-current-context] [target]
Run `kubectl cs` to switch to a Kubernetes context and/or namespace. You can directly specify the context to switch to
in the form of `context:namespace`. If you leave either of the two parts empty, it will only change the remaining part.
Examples:
* `kubectl cs int:` - Switch to the currently active namespace in the `int` context
* `kubectl cs :kube-system` - Switch to the namespace `kube-system` in the currently active context
* `kubectl cs int:kube-system` - Switch to the namespace `kube-system` in the `int` context
If you don't specify anything, `kubectl cs` will present a selection list of all namespaces in all contexts, which can
be filtered and selected. If that takes too long, the flag `--only-current-context` can be used, which only enumerates
the namespaces of the current context.

0 comments on commit ead19ad

Please sign in to comment.