8000 Eliminate kicbase generate docs by nirs · Pull Request #22 · nirs/minikube · GitHub
[go: up one dir, main page]

Skip to content

Eliminate kicbase generate docs - #22

Merged
nirs merged 10 commits into
masterfrom
eliminate-kicbase-generate-docs
Nov 29, 2026
Merged

nirs merged 10 commits into
masterfrom
eliminate-kicbase-generate-docs

Conversation

@nirs
@nirs nirs commented Nov 22, 2026
Copy link
Copy Markdown
Owner

No description provided.

@github-actions
Copy link
Copy Markdown

Hi @nirs, we have updated your PR with the reference to the newly built kicbase image quay.io/nirsof/kicbase:v0.0.51-1795312003-22 (sha256:e69c3285db684ebf6247a48aeb4ef2ce6627b2edcdd69dabfe70a5f203e85dd3).
Pull the changes locally if you want to test with them or update your PR further.

Build logs: https://github.com/nirs/minikube/actions/runs/44972973648

< 8000 /div>
@nirs
nirs force-pushed the eliminate-kicbase-generate-docs branch 3 times, most recently from 0545212 to bbb5f00 Compare November 23, 2026 23:03
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
nirs force-pushed the eliminate-kicbase-generate-docs branch from bbb5f00 to 4c26da8 Compare November 23, 2026 23:09
nirs added 9 commits November 24, 2026 01:14
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
nirs force-pushed the eliminate-kicbase-generate-docs branch from 4c26da8 to ba14d92 Compare November 23, 2026 23:16
@nirs
nirs merged commit 093f33d into master Nov 29, 2026
10 checks passed
@nirs
nirs deleted the eliminate-kicbase-generate-docs branch November 29, 2026 15:30
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.

1 participant

0