Schema validation with $ref cross-file references only works when charts
are available as directories on the filesystem. The install, template, and
upgrade commands may work with archived charts (.tgz) that are loaded
directly into memory without filesystem extraction.
This change limits ChartDir setting to the lint command only. The lint
command already extracts archived charts to temporary directories before
validation, so $ref resolution works for both directory and archived charts
when linting.
For install/template/upgrade commands:
- Main schema validation continues to work
- Charts without $ref validate successfully
- Charts with $ref will fail .. maybe we could add a warning about $ref not being supported in these commands?
Changes:
- Remove ChartDir assignment from install and upgrade commands
- Update schema validation to use synthetic path when chartDir is empty
- Add test for linting archived chart with $ref
- Remove install/template/upgrade tests for $ref (not supported)
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
Extends JSON schema validation to support relative $ref imports
across helm lint, install, template, and upgrade commands.
Addresses George's review comments:
- Pass chartDir directly instead of deriving from valuesPath
- Create new functions instead of changing public API signatures
- Use absolute file paths for proper URL-based $ref resolution
Implementation:
- Added ValidateAgainstSchemaWithPath to resolve $ref using
absolute file paths instead of root-relative URLs
- Thread chartDir through Install/Upgrade structs and all
validation functions
- Updated both v2 (public) and v3 (internal) lint rules
Fixes relative $ref resolution when running commands like:
helm lint ../sample-chart
helm install release ../sample-chart
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
This ensures that when `helm uninstall` is run with `--keep-history`
any release in a `deployed` state other than the last release (e.g.
due to a failed upgrade) is being marked as `superseded`.
As a by-effect, running `helm upgrade` on a release which has been
uninstalled after an upgrade failure now no longer works. But instead
fails with a `"<name>" has no deployed releases` error. Which is the
(likely) intended behavior, and prevents other side-effects like
rolling back to a release version which happened before the uninstall
if `--atomic` (or `--rollback-on-failure`) was provided.
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This adds a --no-headers flag to the 'helm repo list' command,
allowing users to suppress table headers in the output.
Useful for scripting and automation.
Signed-off-by: Paul Van Laer <paul.van.laer1@gmail.com>
The `vaildateTemplatesDir` function would still return `nil` if the directory doesn't exist,
so the early return that was documented never occurs.
Signed-off-by: Zach Burgess <zachburg@google.com>
This reverts #13533
This change has caused issues with numerous charts around things
unrelated to toml. This is because of functions like typeIs/typeOf
being used and acted upon.
The change caused a significant regression.
Note: This kind of change can be put into v3 charts, that are in
active development, without causing a regression.
Closes#30880
Signed-off-by: Matt Farina <matt@mattfarina.com>
A new library was introduced that provides JSON Schema checking for
newer versions of the schema. In Helm v4, there is no need to have
two packages doing the JSON schema validation. The message output
can have breaking changes.
This change moves everything to the newer library. It also uses a
wrapper error to enable a clean Helm only interface for the
public Go API validation functions. This would enable the replacement
of the Schema validation library, if needed, without breaking the
Go API contract.
Signed-off-by: Matt Farina <matt.farina@suse.com>