Skip to content

feat: Add basic spec parsing#78

Merged
mchmarny merged 4 commits intomainfrom
cullen/build-command-phase1
Feb 11, 2026
Merged

feat: Add basic spec parsing#78
mchmarny merged 4 commits intomainfrom
cullen/build-command-phase1

Conversation

@cullenmcdermott
Copy link
Contributor

Summary

Add build spec types, YAML parsing, validation, and status writeback for the new eidos build command, plus declarative value mapping from clusterSpec fields to component overrides.

Motivation / Context

The runtime controller needs Eidos to provide a build subcommand that reads a spec file, generates OCI artifacts, and writes image references back. This MR is the foundation: spec file I/O and a declarative
resolver that translates clusterSpec fields into bundler-compatible value overrides. No templates involved — just a YAML config that maps source paths to target paths.

Fixes: HIPPO-4068
Related: ADR-0013, ADR-0018

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Build/CI/tooling

Component(s) Affected

  • CLI (cmd/eidos, pkg/cli)
  • API server (cmd/eidosd, pkg/api, pkg/server)
  • Recipe engine / data (pkg/recipe)
  • Bundlers (pkg/bundler, pkg/component/*)
  • Collectors / snapshotter (pkg/collector, pkg/snapshotter)
  • Validator (pkg/validator)
  • Core libraries (pkg/errors, pkg/k8s)
  • Docs/examples (docs/, examples/)
  • Other: pkg/build (new package)

Implementation Notes

  • BuildSpec types match the runtime controller's DGXCRuntime struct (apiVersion, kind, spec, status) so the two can read each other's files.
  • ValueResolver reads a mapping.yaml embedded via embed.FS. New mappings are just YAML — no code changes needed.
  • Resolver outputs map[string]map[string]string, which plugs straight into config.WithValueOverrides().
  • mapping.yaml has two example entries for now. Real mappings get added as we integrate.

Testing

make test  # 30+ test cases across spec and mapping

Covers: loading, field validation, writeback round-trip, clusterSpec extraction, nested path traversal, conditional mappings, embedded config loading.

Risk Assessment

  • Low — New package, no changes to existing code, easy to revert
  • Medium — Touches multiple components or has broader impact
  • High — Breaking change, affects critical paths, or complex rollout

Rollout notes: N/A

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are signed off (git commit -s) — https://developercertificate.org/

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Coverage Report ✅

Metric Value
Coverage 73.2%
Threshold 70%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-73.2%25-green)

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/eidos/pkg/build 93.75% (+93.75%) 🌟

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/eidos/pkg/build/doc.go 0.00% (ø) 0 0 0
github.com/NVIDIA/eidos/pkg/build/spec.go 93.75% (+93.75%) 32 (+32) 30 (+30) 2 (+2) 🌟

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/NVIDIA/eidos/pkg/build/spec_test.go

@cullenmcdermott cullenmcdermott marked this pull request as ready for review February 9, 2026 23:22
@cullenmcdermott cullenmcdermott requested review from a team as code owners February 9, 2026 23:22
@cullenmcdermott cullenmcdermott force-pushed the cullen/build-command-phase1 branch 2 times, most recently from d033d8c to e661c24 Compare February 10, 2026 17:05
mchmarny

This comment was marked as resolved.

Copy link
Member

@mchmarny mchmarny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

mchmarny
mchmarny previously approved these changes Feb 10, 2026
Copy link
Member

@mchmarny mchmarny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@mchmarny mchmarny force-pushed the cullen/build-command-phase1 branch from 27d509e to 24165de Compare February 10, 2026 20:43
@mchmarny mchmarny enabled auto-merge (squash) February 10, 2026 21:10
@yuanchen8911
Copy link
Contributor

prealloc lint fix — Line 221 in components_test.go changes allPaths := []string{} to var allPaths []string
//nolint:prealloc. Our PR #88 already fixes this differently (with make preallocation). Whichever merges second
will need a minor conflict resolution.

@mchmarny mchmarny disabled auto-merge February 10, 2026 21:20
@cullenmcdermott cullenmcdermott force-pushed the cullen/build-command-phase1 branch from c86d82a to 8f1228f Compare February 10, 2026 23:03
@cullenmcdermott cullenmcdermott force-pushed the cullen/build-command-phase1 branch from 88c4641 to 39c0adf Compare February 10, 2026 23:04
Copy link
Contributor

@valcharry valcharry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@yuanchen8911 yuanchen8911 self-requested a review February 10, 2026 23:47
@mchmarny mchmarny removed the request for review from yuanchen8911 February 10, 2026 23:47
Copy link
Contributor

@yuanchen8911 yuanchen8911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@mchmarny mchmarny merged commit b9a78e8 into main Feb 11, 2026
6 checks passed
@mchmarny mchmarny deleted the cullen/build-command-phase1 branch February 11, 2026 00:03
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.

4 participants