Skip to content

feat(scripts): add bump-sdk.mjs#2114

Open
mvanhorn wants to merge 1 commit into
helm:mainfrom
mvanhorn:osc/2113-bump-sdk-script
Open

feat(scripts): add bump-sdk.mjs#2114
mvanhorn wants to merge 1 commit into
helm:mainfrom
mvanhorn:osc/2113-bump-sdk-script

Conversation

@mvanhorn
Copy link
Copy Markdown

Summary

Closes #2113. Add scripts/v4/bump-sdk.mjs to automate sdkexamples/ version bumps. The script auto-detects the latest stable Helm v4 release (or accepts an explicit --version), runs go get helm.sh/helm/v4@<version> + go mod tidy + go build ./... in sdkexamples/, and bails non-zero with a clear message when the build fails (e.g. an API rename between releases).

Why this matters

The motivation in #2113 (and the linked review on #2067) was:

  • sdkexamples/ needs to track each new Helm v4 release so the docs-site examples stay buildable.
  • scripts/v4/bump-version.mjs already automates the docs-site side of a release bump, but it is a Node.js script that intentionally does not shell out to the Go toolchain. Extending it would muddy that contract and pull Go into a Node-only file.
  • A standalone script (bump-sdk.mjs) keeps concerns separated and matches the existing per-script directory convention (scripts/v4/).
  • Pure version automation cannot solve every release (v4.1.x renamed InsecureSkipTLSverify -> InsecureSkipTLSVerify, which broke fix(sdkexamples): bump helm.sh/helm/v4 to v4.2.0 and fix build #2067 and required a manual code fix). The script detects the go build failure and exits with a message that names that exact failure mode, so the maintainer knows to fix the example code by hand.

Changes

  • scripts/v4/bump-sdk.mjs (new, +151 lines). Style and arg parsing match the existing bump-version.mjs (--version, --dry-run, --help).
  • No changes to sdkexamples/go.mod or go.sum in this PR. The script is a tool to drive the bump, run separately when the maintainer decides to cut a new docs release.

How to test

Locally, on a clean checkout of main (current SDK pin: v4.1.4, latest stable: v4.2.0):

$ node scripts/v4/bump-sdk.mjs --help
Usage: node scripts/v4/bump-sdk.mjs [options]
...

$ node scripts/v4/bump-sdk.mjs --dry-run
Fetching latest Helm version from GitHub... v4.2.0

=================================================
  Helm SDK examples version bump
  Current  : v4.1.4
  Target   : v4.2.0
  Dir      : sdkexamples/
  DRY RUN  : no files will be written
=================================================

Commands that would run:
  (cd sdkexamples && go get helm.sh/helm/v4@v4.2.0)
  (cd sdkexamples && go mod tidy)
  (cd sdkexamples && go build ./...)

The --version v4.X.Y form was syntax-checked but not run end-to-end against the live registry; that is the next step for the human running the script on the day a release lands.

Acceptance criteria from #2113:

  • Script updates sdkexamples/go.mod and go.sum for the specified (or latest) Helm v4 release - via go get + go mod tidy.
  • Script runs go build ./... and exits non-zero with a clear error if the build fails - runGo(["build", "./..."], ...) exits with a message naming the API-rename failure mode.
  • Supports --version vX.Y.Z flag for explicit version.
  • Supports --dry-run to preview without writing.

Fixes #2113

AI-assisted.

Bumping sdkexamples/ to a new helm.sh/helm/v4 release was a manual chore
(e.g. helm#2067) that required running `go get`, `go mod tidy`, and a build
check by hand. scripts/v4/bump-version.mjs already automates the docs-site
side of a release bump, but it is a Node.js script that intentionally
does not shell out to the Go toolchain, so extending it would muddy that
contract.

Add scripts/v4/bump-sdk.mjs as a sibling: a standalone Node script that
auto-detects the latest stable v4 release (or accepts --version), runs
`go get helm.sh/helm/v4@<version>` + `go mod tidy` + `go build ./...` in
sdkexamples/, and bails with a clear message when the build fails (the
script cannot apply API-rename fixes like
InsecureSkipTLSverify -> InsecureSkipTLSVerify on its own; those need a
human). A --dry-run flag prints the resolved version and the commands
that would run without writing anything.

Fixes helm#2113

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@benoittgt benoittgt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it should be called from scripts/v4/bump-version.mjs even behind a flag --bump-sdk, or at least mentionned at the end of the command output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(sdkexamples): add script to automate helm SDK version bumps

2 participants