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

Open
nirs wants to merge 10 commits into
masterfrom
eliminate-kicbase-generate-docs
Open

nirs wants to merge 10 commits into
masterfrom
eliminate-kicbase-generate-docs

Conversation

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

No description provided.

nirs added 10 commits November 22, 2026 03:14
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.
@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

@nirs
nirs force-pushed the eliminate-kicbase-generate-docs branch from f5a8ee0 to d8fd203 Compare November 22, 2026 02:08
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