From 5980869555aa4650303a4ad2ff518235802150a2 Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Tue, 1 Dec 2026 18:57:28 +0100 Subject: [PATCH] Publish krew manifest to custom index on release Signed-off-by: Karol Szwaj --- .github/workflows/cli.yaml | 10 +++++++--- .goreleaser.yaml | 30 +++++++++++++++++++++++++++++- .krew.yaml | 7 ++++--- docs/RELEASING.md | 17 +++++++++++++++++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cli.yaml b/.github/workflows/cli.yaml index f6a049b9a..ff977a096 100644 --- a/.github/workflows/cli.yaml +++ b/.github/workflows/cli.yaml @@ -1,9 +1,12 @@ name: CLI # Release the bind CLI on FINAL tags via goreleaser (archives, checksums, -# GitHub release), then let krew-release-bot render .krew.yaml and PR -# krew-index for the "bind" plugin (name kept from v1; archive binary is -# kubectl-bind). +# GitHub release). The "bind" krew plugin is published to two indexes: +# goreleaser's krews pushes the manifest to the custom index +# kbind-dev/krew-index (KREW_GITHUB_TOKEN), and krew-release-bot renders +# .krew.yaml and PRs the central kubernetes-sigs/krew-index (the first +# central submission must be a manual PR, the bot only updates existing +# plugins). # # Release candidates (v*-rc*, any v*-* prerelease) do NOT release the CLI: # users' binaries and the krew plugin only move forward on final versions. @@ -33,6 +36,7 @@ jobs: - name: Run goreleaser env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + KREW_GITHUB_TOKEN: ${{ secrets.KREW_GITHUB_TOKEN }} run: go run github.com/goreleaser/goreleaser/v2@v2.5.0 release --clean # Renders .krew.yaml against this release and PRs krew-index. Pinned by diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 62289e96b..d3359ec15 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,6 +1,7 @@ # goreleaser config for the bind CLI (pinned to goreleaser v2.5.x in CI). # Archives carry the binary as kubectl-bind for the krew "bind" plugin; -# krew-release-bot (not goreleaser's krews) PRs upstream krew-index. +# krews below pushes the manifest to the custom kbind-dev/krew-index, and +# krew-release-bot PRs the central kubernetes-sigs/krew-index. version: 2 project_name: bind @@ -48,3 +49,30 @@ snapshot: changelog: use: github-native + +# Push the rendered "bind" manifest to the project's custom krew index +# (kbind-dev/krew-index) on final releases, as v1 did. The central +# kubernetes-sigs/krew-index is updated separately by krew-release-bot. +krews: + - name: bind + ids: + - bind + repository: + owner: kbind-dev + name: krew-index + token: "{{ .Env.KREW_GITHUB_TOKEN }}" + commit_msg_template: "Krew manifest update for kbind version {{ .Tag }}" + homepage: https://github.com/kbind-dev/kbind + short_description: Bind a service provider's APIs into your cluster + description: | + bind binds APIs exported by a provider cluster into your cluster: + log in to a provider's gateway, browse its catalog, and bind a service. + The result is a one-apply bundle (Secret + Connection + ClusterBinding) + consumed by the konnector, the only component that runs on your side. + caveats: | + Typical flow: + kubectl bind login https://provider.example.com + kubectl bind connect # install the konnector + kubectl bind catalog + kubectl bind export # or: export -o yaml (GitOps) + skip_upload: auto diff --git a/.krew.yaml b/.krew.yaml index 491ef0ab7..e9579d34b 100644 --- a/.krew.yaml +++ b/.krew.yaml @@ -1,6 +1,7 @@ -# krew-release-bot template for the "bind" plugin (name kept from v1 — the -# CLI binary is kbind, installed via krew as `kubectl bind`). The bot renders -# this on every GitHub release and opens the krew-index PR. +# krew-release-bot template for the central kubernetes-sigs/krew-index +# ("bind" plugin, binary kubectl-bind, installed as `kubectl bind`). The bot +# renders this on every GitHub release and PRs krew-index. The custom index +# kbind-dev/krew-index is updated by goreleaser's krews instead. apiVersion: krew.googlecontainertools.github.com/v1alpha2 kind: Plugin metadata: diff --git a/docs/RELEASING.md b/docs/RELEASING.md index b82601d23..9ebf51ff2 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -160,6 +160,23 @@ git push origin v2.0.1 sdk/v2.0.1 gh release create v2.0.1 --generate-notes ``` +## krew indexes + +The `bind` plugin is published to two krew indexes on final releases: + +- **Custom index** [kbind-dev/krew-index](https://github.com/kbind-dev/krew-index): + goreleaser's `krews` pushes the manifest directly (needs the + `KREW_GITHUB_TOKEN` secret). Users: `kubectl krew index add kube-bind + https://github.com/kbind-dev/krew-index.git && kubectl krew install + kube-bind/bind`. +- **Central index** kubernetes-sigs/krew-index: krew-release-bot renders + `.krew.yaml` and opens the version-bump PR. The first submission must be + a manual PR adding `plugins/bind.yaml`, the bot only updates existing + plugins. + +A krew index serves one version per plugin, so publishing v2.0.0 moves +`kube-bind/bind` users forward from v1 on their next `krew upgrade`. + ## Naming conventions Documentation follows the release: pushes to `main` publish the `main`