Repository navigation
Eliminate kicbase generate docs - #22
Merged
Merged
Conversation
|
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
3 times, most recently
from
November 23, 2026 23:03
0545212 to
bbb5f00
Compare
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.
nirs
force-pushed
the
eliminate-kicbase-generate-docs
branch
from
November 23, 2026 23:09
bbb5f00 to
4c26da8
Compare
The reason package requires a distinct Kind for nearly every failure site, including many Internal* kinds that differ only by ID. This does not scale: every new error path needs its own ID and exit code even when the message and remediation are the same, and callers sometimes reuse an unrelated kind, such as MK_OUTPUT_USAGE, for genuinely unexpected errors. Add InternalError as the default Kind for unexpected internal failures. It uses the existing ExFailure exit code (1). Add a specific Kind only when it needs distinct messaging, advice, issue matching, or an exit code that callers rely on; otherwise use InternalError.
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. Validate --output at the start of the command before collecting data or formatting, so formatVersion returns ordinary errors for JSON and YAML marshal failures. An invalid output format inside formatVersion now panics as a programmer error. The command reports unexpected failures with exit.Error and the generic internal error reason, using the translated "version failure" message. Update the translation strings to remove the old JSON/YAML failure keys and add the new message. Note: the "version failure" message is extracted into the translations but is not used at runtime. exit.Error combines the message and error before translate.T looks up the string, so the lookup key never matches. This is a pre-existing issue tracked in kubernetes#24121.
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, and components with JSON/YAML. 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. Remove the stale test comment that described the old layout as intentional. 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. If marshaling fails, return
the error so the command reports it as an unexpected internal error.
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.
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.
nirs
force-pushed
the
eliminate-kicbase-generate-docs
branch
from
November 23, 2026 23:16
4c26da8 to
ba14d92
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.