Skip to content

feat: Tools multi-version selector helpers#31

Merged
mallardduck merged 11 commits into
mainfrom
tool-version
Apr 30, 2026
Merged

feat: Tools multi-version selector helpers#31
mallardduck merged 11 commits into
mainfrom
tool-version

Conversation

@mallardduck
Copy link
Copy Markdown
Member

@mallardduck mallardduck commented Apr 29, 2026

Attempt to solve: #29

  • Adjusts helmv4 to be default helm binary (leaves helm_v3 alias used in some CIs for helm 3)
  • Adds concept of "tool family" to group tools and generate selector helper scripts
  • Adds new tool family concept to relevant lock file generation
  • Add /var/ci-tools/active to PATH to ensure selected tools come first

DEMO:

Change helm with helm specific helper:

→ docker run -it ghcr.io/rancher/ci-image/go1.25:latest
7a4f7716c530:/go # helm version
version.BuildInfo{Version:"v4.1.4", GitCommit:"05fa37973dc9e42b76e1d2883494c87174b6074f", GitTreeState:"clean", GoVersion:"go1.25.9", KubeClientVersion:"v1.35"}
7a4f7716c530:/go # select-helm helmv3
helm is now: helmv3
7a4f7716c530:/go # helm version
version.BuildInfo{Version:"v3.20.2", GitCommit:"8fb76d6ab555577e98e23b7500009537a471feee", GitTreeState:"clean", GoVersion:"go1.25.9"}

Or with core helper (which all tool-family specific ones use):

7a4f7716c530:/go # ci-select helm helmv4
helm is now: helmv4
7a4f7716c530:/go # helm version
version.BuildInfo{Version:"v4.1.4", GitCommit:"05fa37973dc9e42b76e1d2883494c87174b6074f", GitTreeState:"clean", GoVersion:"go1.25.9", KubeClientVersion:"v1.35"}

@mallardduck
Copy link
Copy Markdown
Member Author

Long term @macedogm plan to get packages installable via zypper to enable multiple version support is best. However this will enable devs to solve the DX issue with multiple binary tools immediately.

@mallardduck mallardduck changed the title WIP: Tool version selector feat: Tools multi-version selector helpers Apr 29, 2026
@mallardduck mallardduck marked this pull request as ready for review April 29, 2026 21:32
@mallardduck mallardduck requested review from a team and tashima42 as code owners April 29, 2026 21:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds “tool family” selectors to Rancher CI images so multiple versions of a tool (e.g., Helm v3/v4) can coexist and be switched at runtime via ci-select / select-<family> helpers, addressing #29.

Changes:

  • Introduces selector infrastructure (manifest + active symlinks) and prepends /var/ci-tools/active to PATH for images that include selectors.
  • Adds generator support for per-family and generic selector scripts, and records selectors in images-lock.yaml + changelog diffing.
  • Renames Helm v3 binary to helmv3 and makes Helm v4 the default helm via the selector.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/dockerfile/tmpl/selector_setup.tmpl Adds template to create selector manifest + default active symlinks during image build.
internal/dockerfile/tmpl/dockerfile.tmpl Wires selector setup into rendered Dockerfiles (PATH, COPY scripts, RUN setup).
internal/dockerfile/spec.go Adds selector metadata to DockerfileVars and template-rendered setup command helper.
internal/dockerfile/generate.go Generates ci-select.sh and per-family select-*.sh scripts; provides selector-family name listing.
internal/dockerfile/build.go Collects selector families/defaults per image and passes them into Dockerfile rendering.
internal/config/validate.go Validates family definitions and blocks alias names that would conflict with selectors.
internal/config/config.go Extends tool schema with family + family_default; introduces ChecksumList type alias.
internal/cli/generate.go Writes selector scripts to dockerfiles/scripts/ and cleans up stale selector scripts; extends images-lock structure.
internal/changelog/types.go Extends lock/changelog types to include selectors and per-image selector default changes.
internal/changelog/diff_test.go Adds tests for selector added/removed/default-changed diff behavior.
internal/changelog/diff.go Computes selector diffs globally and selector-default changes per image.
internal/changelog/changelog.go Renders selector additions/removals and per-image default changes in changelog entries.
images-lock.yaml Records selector families and per-image family defaults; renames helm tool entry to helmv3.
dockerfiles/scripts/select-helm.sh Adds helm-specific wrapper script invoking ci-select helm.
dockerfiles/scripts/ci-select.sh Adds generic selector script to list/select tools by family using the manifest.
dockerfiles/Dockerfile.python3.13 Applies selector PATH + scripts; renames helm v3 install to helmv3; sets up helm family selector.
dockerfiles/Dockerfile.python3.11 Applies selector PATH + scripts; renames helm v3 install to helmv3; sets up helm family selector.
dockerfiles/Dockerfile.node24 Applies selector PATH + scripts; renames helm v3 install to helmv3; sets up helm family selector.
dockerfiles/Dockerfile.node22 Applies selector PATH + scripts; renames helm v3 install to helmv3; sets up helm family selector.
dockerfiles/Dockerfile.go1.26 Applies selector PATH + scripts; renames helm v3 install to helmv3; updates helm_v3 alias; sets up selector.
dockerfiles/Dockerfile.go1.25 Applies selector PATH + scripts; renames helm v3 install to helmv3; updates helm_v3 alias; sets up selector.
dockerfiles/Dockerfile.charts Applies selector PATH + scripts; renames helm v3 install to helmv3; sets up helm family selector.
deps.yaml Renames helm v3 tool to helmv3, defines helm family and default (helmv4), updates helm_v3 alias targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/config/validate.go Outdated
Comment thread internal/dockerfile/generate.go
Comment thread internal/cli/generate.go Outdated
Comment thread internal/dockerfile/build.go
Comment thread dockerfiles/scripts/ci-select.sh Outdated
@mallardduck mallardduck merged commit ac39a42 into main Apr 30, 2026
8 checks passed
@mallardduck mallardduck deleted the tool-version branch April 30, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants