Repository navigation
Conversation
The version command builds its output from an ad-hoc map that mixes
collected data and formatting. That makes the formatting code difficult
to extract and test, and leaves no clear place to add the upcoming
kicbase and iso image lists.
Introduce versionInfo to hold the data the command collects: version,
commit, and component versions. The machine-readable representation
still uses map[string]interface{} because values will include []string
entries for kicbase and iso images, while most components remain
strings.
This is a mechanical refactor: command output and flag handling are
unchanged.
The version command formats output and exits directly from the command logic, emitting lines through the out package as it goes. That keeps formatting, output, and exit behavior entangled with data collection and makes the formatting code hard to test. Move formatting into formatVersion, which writes to a strings.Builder and returns the complete output string. Before, output was emitted line by line through out.Ln and the process exited on the first formatting error. After, the formatter returns a versionError carrying the reason and message, and the command writes the result with out.String and performs the exit. This is a mechanical extraction: command output and flag handling are unchanged.
The version formatter now takes controlled versionInfo data but has no tests. Add golden-file coverage for the current behavior so the upcoming text-format change can be reviewed as an intentional diff. Cover default output, empty commit, components, --short, JSON, YAML, short combined with JSON/YAML, components with JSON/YAML, and invalid output. The goldens intentionally capture the current block component format and the extra trailing newline after YAML; those remain separate fixes. Force LF for testdata text files so the fixtures work on Windows.
yaml.Marshal already terminates the document with a newline. The formatter appended another newline, leaving a blank line after the YAML output. This was preserved from the previous out.Ln call when formatting was extracted. Return the marshaled bytes unchanged and update the YAML testdata to match.
The default text output used key: value for the first lines, but rendered components with a blank line, a heading, and an unindented value on the next line. That was not valid YAML for scalar values and looked broken for single-line component versions. Render sorted components as key: value lines with no blank separators and update the testdata. JSON and YAML output are unchanged.
The default text formatter writes key/value lines manually. That works
for strings but would require special handling for the upcoming kicbase
and iso image lists.
Build an ordered yaml.MapSlice with the legacy key names and marshal it.
This keeps the current output unchanged and lets the YAML encoder render
future list fields in the standard block form.
For example, a future kicbase field is just another ordered item:
ordered = append(ordered, yaml.MapItem{
Key: "kicbase",
Value: info.Kicbase,
})
and yaml.Marshal renders it as:
kicbase:
- image1
- image2
without any list-specific formatting code.
The version command will report the built-in kicbase images. Add a helper returning the primary image as a list so callers do not need to change when additional registry fallbacks are published. Only BaseImage is returned today. The fallback list stopped working when kicbase builds moved to GitHub Actions: the workflow cannot push images to gcr.io, so the gcr.io fallback is stale. DefaultImages exposes the image minikube actually uses instead of advertising broken fallbacks. When publishing moves to quay.io, restore the fallback and append it here.
Users debugging a failed kicbase pull need the exact built-in image
reference, but the version output does not include it. The image is also
about to become the default documented elsewhere, so expose it from the
version command.
Add Kicbase to versionInfo, populate it from kic.DefaultImages(), and
render it as an ordered list in text output and as an array in JSON/YAML.
The list entries are complete image references so they can be used
directly. Since the default text output is YAML, for example:
podman pull "$(minikube version | yq '.kicbase[0]')"
Tests use a synthetic multi-image list with a fixed real digest so they
do not change with every kicbase build.
The version formatter now reports a generic "version failure" fallback instead of the removed JSON/YAML failure strings. Regenerate translations to keep strings.txt and locale files in sync.
pflag prints the `--base-image` default in `--help` and in the generated
command docs. The image digest changes with every kicbase build, so the
kicbase workflow had to run `make generate-docs` in a job with repository
secrets and write access.
Register `--base-image` with an empty default and supply the built-in
image through `viper.SetDefault`, preserving flag, env, and config
precedence.
Removing `make generate-docs` also eliminates the `Set up Go` step and
simplifies the manual recovery instructions when the bot fails to push a
commit.
Since the help text no longer shows the image, add a hint pointing to
`minikube version`:
% minikube start --help | grep -A1 base-image
--base-image='':
The base image to use for docker/podman drivers. Intended for local
development. See "minikube version" for the default images.
|
Hi @nirs, we have updated your PR with the reference to the newly built kicbase image Build logs: https://github.com/nirs/minikube/actions/runs/44972973648 |
nirs
force-pushed
the
eliminate-kicbase-generate-docs
branch
from
November 22, 2026 02:08
f5a8ee0 to
d8fd203
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.