Skip to content

feat(carvel): support structured BOSH variable declarations in base.yml - #664

Merged
drich10 merged 3 commits into
mainfrom
feat/carvel-variable-declarations
Jun 19, 2026
Merged

feat(carvel): support structured BOSH variable declarations in base.yml#664
drich10 merged 3 commits into
mainfrom
feat/carvel-variable-declarations

Conversation

@drich10

@drich10 drich10 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Changes Variables []stringVariables []proofing.Variable in internal/carvel/models/metadata.go and metadata_out.go
  • Adds validateVariables() to baker.go — returns a clear error if a variable entry is missing name or type
  • Covers with 4 new Ginkgo unit specs + updates testdata/sample-tile/base.yml for integration round-trip coverage

Motivation

Carvel tile authors need to declare BOSH CredHub variable definitions (e.g., certificate CA hierarchies) inline in base.yml. The previous []string type rejected structured map entries with a YAML unmarshal error:

yaml: unmarshal errors:
  line 34: cannot unmarshal !!map into string

Discovered while building the EAR-K8s tile's Diego Instance Identity CA support. The EAR-K8s tile mirrors the TAS IST tile's pattern of declaring diego-instance-identity-intermediate-ca-2-7 as a BOSH CredHub certificate variable so BOSH manages the CA lifecycle automatically.

Why proofing.Variable?

pkg/proofing already models this shape (name, type, options any). Reusing it avoids duplicating the struct. The import direction (internal/carvelpkg/proofing) is valid — no circular dependency.

Test Plan

  • go test ./internal/carvel/... --ginkgo.focus="validateVariables" — 4 new unit specs pass
  • go test ./internal/carvel/... — 36/36 specs pass, including integration round-trip for structured variables
  • go build ./internal/carvel/... — clean build

Related

TNZ-112157

Made with Cursor

drich10 and others added 2 commits June 18, 2026 17:00
Changes Variables []string to []proofing.Variable in both Metadata
structs. Adds validateVariables() to baker.go to catch missing name/type
at bake time. Covers with 4 Ginkgo specs.

TNZ-112157

Co-authored-by: Cursor <cursoragent@cursor.com>
…overage

Updates testdata/sample-tile/base.yml from variables: [] to a real
certificate variable declaration, and updates the "populates the output
metadata" integration test to assert the variable is preserved through
the bake process.

TNZ-112157

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread internal/carvel/baker_test.go Outdated
Comment thread internal/carvel/baker_test.go Outdated
Comment thread internal/carvel/baker.go Outdated
…ations

- Fix indentation of Variables[0] assertions to match surrounding 5-tab style
- Add Options assertions (common_name, is_ca) to verify round-trip fidelity of
  the full variable definition including nested options block
- Refactor validateVariables to use errors.Join so all malformed entries are
  reported in a single error instead of failing on the first one
- Fix pre-existing AfterEach indentation so gofmt is clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drich10
drich10 merged commit 8dc0354 into main Jun 19, 2026
6 checks passed
@drich10
drich10 deleted the feat/carvel-variable-declarations branch June 19, 2026 20:33
drich10 added a commit that referenced this pull request Jun 22, 2026
…dateVariables

Both branches added code after the progress() function: the PR branch added
boshLinkConsumer/jobSpecOverlay types; main added validateVariables (from #664).
Include both blocks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants