Skip to content

feat(schemas): default Talos image build output and tighten dir constraint#67

Merged
jmgilman merged 1 commit intomasterfrom
session-057/talos-schema-cleanup
May 3, 2026
Merged

feat(schemas): default Talos image build output and tighten dir constraint#67
jmgilman merged 1 commit intomasterfrom
session-057/talos-schema-cleanup

Conversation

@jmgilman
Copy link
Copy Markdown
Contributor

@jmgilman jmgilman commented May 3, 2026

Summary

Shrink the minimum valid Talos image build config so authors can omit the entire output: block when lab defaults are appropriate, and bring output.dir into the same #RelativePath constraint already applied to file inputs. The minimal example in the schema README drops to four fields; everything else defaults.

This is PR 3 of 5 from the session 057 plan. Independent of PR 1 (#65) and PR 2 (#66) — different files entirely. Triggers a schemas/lab release cycle.

What changed

  • output.dir defaults to .state/images and is now #RelativePath. Absolute paths and .. segments are rejected at validation time, matching userData.path.
  • output.bootArtifactName defaults to talos-boot.img.
  • output.configArtifactName defaults to talos-cidata.img.
  • output itself is now optional on #ImageBuild because every nested field has a default. The minimal example in schemas/lab/talos/README.md drops to name + source.version + config.userData.path + config.metaData.localHostname.

The generated Go types lose their NonEmptyString / ArtifactName named-string constraints because CUE renders *default | type disjunctions as the underlying Go string. The cast removals in tools/labctl/internal/app/talosimage/service.go follow from that — the validator still enforces the constraints at YAML parse time, the Go type system just no longer carries them.

Why now

Session 057's review flagged that the existing output.dir was looser (#NonEmptyString) than the analogous #FileInput.path (#RelativePath), and that several output fields were required when they had stable, unsurprising defaults. Authors can now write a four-field config to build a default lab image.

Out of scope

Release machinery

After merge, Release Please will open a chore(master): release schemas/lab X.Y.Z PR. Following session 056's pattern: merge that, then manually publish the CUE module (cue mod publish) until the Publish Lab Schemas workflow's GHCR auth is fixed, then bump labctl's go.mod if needed in a follow-up. Local labctl tests pass via go.work resolving to the local schemas dir, so master CI stays green during the release cycle.

Test plan

  • go test ./... from tools/labctl/ and schemas/lab/ — full suites pass.
  • moon run schemas:check labctl:check --summary minimal — all green.
  • moon ci --summary minimal from platform/ — all 14 actions pass.
  • New unit test (talosconfig.TestValidateYAMLAppliesOutputDefaults) confirms the four defaults render when output: is omitted.
  • New txtar case talos-minimal.yaml confirms a config with no output: block produces artifacts at .state/images/talos-boot.img and .state/images/talos-cidata.img.
  • Existing parent-path test (#FileInput.path) continues to enforce #RelativePath rejection — covers the same constraint type now applied to output.dir.

🤖 Generated with Claude Code

…raint

Shrink the minimum valid Talos image build config so authors can omit
the entire `output:` block when the lab defaults are appropriate, and
tighten `output.dir` to share the same #RelativePath constraint already
applied to file inputs.

- output.dir defaults to ".state/images" and is now #RelativePath, so
  absolute paths and `..` segments are rejected at validation time the
  same way userData.path already is.
- output.bootArtifactName defaults to "talos-boot.img".
- output.configArtifactName defaults to "talos-cidata.img".
- output is now optional on #ImageBuild because every nested field has
  a default. The minimal example in README.md drops down to name +
  source.version + config.userData.path + config.metaData.localHostname.

The generated Go types lose their NonEmptyString/ArtifactName
constraints because CUE renders `*default | type` disjunctions as the
underlying Go string. The cast removals in tools/labctl service.go
follow from that — the validator still enforces the constraint at YAML
parse time.

Tests cover the new defaults via a minimal-config validator test and a
new minimal-config txtar case asserting artifacts land at
.state/images/talos-{boot,cidata}.img with no overrides.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jmgilman jmgilman force-pushed the session-057/talos-schema-cleanup branch from f26e029 to a4e8e51 Compare May 3, 2026 05:20
@jmgilman jmgilman merged commit d2d036d into master May 3, 2026
6 checks passed
@jmgilman jmgilman deleted the session-057/talos-schema-cleanup branch May 3, 2026 05:27
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