Skip to content

feat: add bundle subcommand to run the bundler on a schema file - #354

Merged
losisin merged 2 commits into
losisin:mainfrom
somaz94:feat/bundle-command
Jun 10, 2026
Merged

losisin merged 2 commits into
losisin:mainfrom
somaz94:feat/bundle-command

Conversation

@somaz94

@somaz94 somaz94 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Which problem does the PR fix?

Closes #266

What's in this PR?

Adds a helm schema bundle SCHEMA_FILE subcommand that runs only the bundler on an existing JSON schema file and prints the bundled result to stdout, without generating a new schema from values files:

$ helm schema bundle values.schema.json
{
  ...
}

It reuses the existing Bundle() logic, so it supports the same --bundle-root, --bundle-without-id, --k8s-schema-url and --k8s-schema-version options, plus --indent.

Checklist

  • Tests for the new subcommand are added (table-driven tests; newBundleCmd 100%, BundleFile 91.3% coverage)
  • In-repo documentation updated (README "Bundle subcommand" section)
  • go test -short ./..., golangci-lint, gosec, go vet and gofmt all clean

@losisin
losisin requested review from applejag and losisin June 1, 2026 05:43
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (58bd749) to head (69cbcc3).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #354   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        19    +1     
  Lines         2003      2059   +56     
=========================================
+ Hits          2003      2059   +56     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@applejag applejag left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just started my vacation, so I can't help review this right now.

@somaz94
somaz94 marked this pull request as ready for review June 4, 2026 01:53

@losisin losisin left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@somaz94 Nice work overall and this looks good to merge with one UX/documentation addition.

Since helm schema bundle doesn't call LoadConfig(), settings from .schema.yaml (and --config) are silently ignored today. That’s acceptable for this PR, but worth making explicit so users aren’t surprised, especially if they rely on .schema.yaml as the single source of truth for bundleRoot, indent, k8sSchemaVersion, etc...

Can you add a short notice block about this in the README.md? Optionally, add a one-line reminder on stderr when the bundle command runs would be appreciated but it's not a deal breaker.

Also noting for a follow-up: bundle-related flags are currently registered twice (root command + bundle subcommand). Works fine for now, but worth extracting a shared helper later to avoid drift. After we merge this, a follow up issue needs to be opened to address this.

@somaz94
somaz94 force-pushed the feat/bundle-command branch from 3ca5571 to 69cbcc3 Compare June 10, 2026 06:18
@somaz94

somaz94 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @losisin! Addressed the feedback:

  • Rebased onto main to resolve the merge conflict (the lint subcommand from feat: add lint subcommand to validate the config and input files #355 had landed and overlapped on README.md / pkg/cmd.go — both subcommands are now registered).
  • README notice — added a > [!NOTE] block under the Bundle subcommand documenting that bundle does not call LoadConfig(), so .schema.yaml / --config settings (bundleRoot, indent, k8sSchemaVersion, …) are ignored; users should pass --bundle-root / --indent / --k8s-schema-version directly.
  • stderr reminder (your optional suggestion) — bundle now prints a one-line warning: to stderr only when --config is explicitly set, so the silently-ignored config doesn't surprise anyone while keeping the default (no-config) output clean. Covered by a new test case.

go build / go test ./... / golangci-lint all green locally.

Re: the duplicated flag registration (root + bundle) — agreed it's worth a shared helper; happy to open a follow-up issue after this merges so we don't grow the diff here.

@losisin
losisin self-requested a review June 10, 2026 06:43

@losisin losisin left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice work! I'll release new version by the end of the day.

@somaz94 please open follow up issue for the duplicated flags

@losisin
losisin merged commit 7ecd62b into losisin:main Jun 10, 2026
9 checks passed
@somaz94

somaz94 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Opened #356 for the duplicated bundle flags (shared registration helper). Thanks for the review and the quick release @losisin! 🙏

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.

Add helm schema bundle command to just run the bundler

3 participants