Commit graph

34 commits

Author SHA1 Message Date
Mads Jensen
6cceead399 Use modernize to use newer Golang features.
The rangeint suggestion is faster.
The maps.Copy and slices.Contains are just syntatic sugar.

Signed-off-by: Mads Jensen <atombrella@users.noreply.github.com>
2025-11-22 18:52:40 +01:00
Matt Farina
0f5eda74c1
Adding a LoadArchive to common loader
LoadArchive is in the individual loaders for the chart versions.
It is used by SDK users to load a stream rather than a file on
the filesystem. Adding to support SDK users like Flux.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-11-06 09:08:30 -05:00
Matt Farina
61d3eca55c
Move pkg/chart to pkg/chart/v2 to prepare for v3 charts
This change moves the code, updates the import locations, and
adds a doc.go file to document what the v2 package is for.

This is part of HIP 20 for v3 charts

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-25 15:20:44 -05:00
lubingtan
3d84e00ce7 fix: use Reader interface as the input of LoadValues and enhance UT of LoadValues
Signed-off-by: lubingtan <bingtanlu@gmail.com>
2025-02-20 08:08:18 +08:00
lubingtan
92087f6e33 feat: support multi-document values files for default chart values
Signed-off-by: lubingtan <bingtanlu@gmail.com>
2025-02-20 08:07:46 +08:00
Matt Farina
2236294119 Updating to helm.sh/helm/v4
Since Helm is going through breaking changes with Helm v4, the version path to
Helm needs to be updated.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-12-26 16:33:51 -05:00
Matt Farina
4e7e939f19
Updating the Go version in go.mod
At this time both Go 1.19 and 1.20 are supported. The version
specified in the go.mod file is the minimum version we expect Helm
to be compiled against. This is the oldest supported version to
support environments where others compile Helm. The Helm project
is using Go 1.20 to build Helm itself.

Updating to Go 1.19 also includes dealing with io/ioutil
deprecation and some additional linting issues around staticcheck.
All the staticcheck issues were in test files so linting was
skipped for those.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:52:30 -04:00
Eng Zer Jun
2e3e22a003
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-12 13:54:54 +08:00
Matt Farina
1cd749359c
Merge pull request #9009 from mattfarina/tests-for-8948
Tests for 8948
2020-11-10 14:32:47 -05:00
Matt Farina
82002c3cfb Added tests for PR 8948
LoadFiles needs to load the Chart.yaml file first. When later files
are loaded there are checks for metadata. If that is not loaded
the checks could be handled incorrectly.

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-11-10 11:57:02 -05:00
Matt Farina
c0d3877231
Merge pull request #8915 from zheng1/master
Bugfix: panic when chart contains requirements.lock
2020-10-29 10:09:43 -04:00
Zhengyi Lai
9cc00eea24
Add test case for LoadFiles
Signed-off-by: Zhengyi Lai <zheng1@yunify.com>
2020-10-29 15:11:32 +08:00
Matt Butcher
5f3e560029
improved user-facing error messages to explain the underlying problem (#8731)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-10-19 12:15:53 -06:00
Zhou Hao
0669f40e81 cleanup tempfiles for load_test
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-08-28 13:38:29 +08:00
Thomas FREYSS
c422e51ca1 test: add test for bom test data integrity
Signed-off-by: Thomas FREYSS <thomas.freyss@gmail.com>
2020-04-24 11:09:27 +02:00
Thomas FREYSS
27ebfa8c56 fix(*): remove bom in utf files when loading chart files (#6081)
Removes the BOM prefix if present, in read files before
processing the data.
Affects the following pkg:
- pkg/chart/loader: directory and archive loader
- internal/ignore: when loading .helmignore file

Signed-off-by: Thomas FREYSS <thomas.freyss@gmail.com>
2020-04-23 14:56:26 +02:00
Josh Soref
02ad2b1187 Spelling (#7258)
* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cryptographic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesnot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: don't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unexpected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dreadnought

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: default

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: envvars

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: evaluates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: execute

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: extractor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: frobnitz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implementation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabba

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: keywords

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: override

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: package

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: progress

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recursively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: release

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cache

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: representing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: serializer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subchart

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: utilities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2019-12-18 12:04:08 +00:00
Matthew Fisher
bd1f4a443e
fix(show): restore comments from raw values
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-11-05 11:50:30 -08:00
Matthew Fisher
5a7d4f1f74
fix(loader): error out when loading irregular files
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-10-29 10:01:26 -07:00
Sidharth Surana
31d41d3fd1 Add unit test for this specific case of loading from V1 archive
Added a tgz "frobnitz.v1.tgz" of the testdata folder frobnitz.v1
Verified that without the fix the unit test fails and re-produces
the issue.

Signed-off-by: Sidharth Surana <ssurana@vmware.com>
2019-10-16 11:36:53 -07:00
Taylor Thomas
3637996dcd fix(chart): Ports security fix for invalid paths in tarballs
This is a port of #5165 and the small refactor in #5610. This is the issue
where carefully crafted paths can reach outside of the intended chart directory

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-10-08 10:13:43 -06:00
Matt Farina
9bc7934f35
Updating the module for v3 as the major version
Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-10-03 14:27:05 -04:00
Martin Hickey
4d47052395 Update linting and checking for apiVersion v1/v2
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2019-08-02 15:52:14 +01:00
Adam Reese
b49db9e6e6
ref(pkg/chartutil): break up chartutil into logical files
Signed-off-by: Adam Reese <adam@reese.io>
2019-05-22 19:38:11 +02:00
Adam Reese
634fcfb7ef
feat(pkg/chart): support deprecated requirements.yaml
Signed-off-by: Adam Reese <adam@reese.io>
2019-05-15 13:23:26 -07:00
Ian Howell
ffff0e8c33 Feat/schema validation (#5350)
* Add the Schema type and a function to read it

* Added a function to read a schema from a file

* Check that values.yaml matches schema

This commit uses the gojsonschema package to validate a values.yaml file
against a corresponding values.schema.yaml file.

* Add functionality to generate a schema from a values.yaml

* Add Schema to Chart and loader

* Clean up implementation in chartutil

* Add tests for helm install with schema

* Add schema validation to helm lint

* Clean up "matchSchema"

* Modify error output

* Add documentation

* Fix a linter issue

* Fix a test that broke during a rebase

* Clean up documentation

* Specify JSONSchema spec

Since JSONSchema is still in a draft state as of this commit, we need to
specify a particular version of the JSONSchema spec

* Switch to using builtin functionality for file extensions

* Switch to using a third-party library for JSON conversion

* Use the constants from the gojsonschema package

* Updates to unit tests

* Minor change to avoid string cast

* Remove JSON Schema generation

* Change Schema type from map[string]interface{} to []byte

* Convert all Schema YAML to JSON

* Fix some tests that were broken by a rebase

* Fix up YAML/JSON conversions

* This checks subcharts for schema validation

The final coalesced values for a given chart will be validated against
that chart's schema, as well as any dependent subchart's schema

* Add unit tests for ValidateAgainstSchema

* Remove nonessential test files

* Remove a misleading unit test

The TestReadSchema unit test was simply testing the ReadValues function,
which is already being validated in the TestReadValues unit test

* Update documentation to reflect changes to subchart schemas
2019-04-26 08:45:03 -07:00
Adam Reese
e458a67f0c
ref(pkg/chart): add validation method to chart
Consolidate validation of Chart.yaml.

Signed-off-by: Adam Reese <adam@reese.io>
2019-04-05 13:40:06 -07:00
Adam Reese
895e9192d4
feat(*): use vanity import helm.sh/helm
Signed-off-by: Adam Reese <adam@reese.io>
2019-03-13 13:43:47 -07:00
Adam Reese
85aef0d3d7
ref(pkg/chart): rename Requirements to Dependencies
Signed-off-by: Adam Reese <adam@reese.io>
2018-11-28 10:20:33 -08:00
Adam Reese
21259507bd
ref(*): rename requirements.lock to Chart.lock
Signed-off-by: Adam Reese <adam@reese.io>
2018-08-29 14:43:37 -07:00
Adam Reese
f7a7a157ce
ref(*): merge requirement.yaml into Chart.yaml
Signed-off-by: Adam Reese <adam@reese.io>
2018-08-29 14:05:37 -07:00
Adam Reese
516c53dae6
ref(chart): use map for chart.Values
Signed-off-by: Adam Reese <adam@reese.io>
2018-08-29 09:56:19 -07:00
Adam Reese
4f26b658d8
change copyright to "Copyright The Helm Authors" 2018-08-24 12:03:55 -07:00
Adam Reese
f012940d9c
ref(*): refactor chart/chartutil
ref(chartutil): move chart loading out of chartutil into new package
    add chart loader interface to allow lazy loading
feat(chart): create chart accessors
ref(*): cleanup requirements
ref(tiller): remove optional template engines
ref(tiller): simplify sorting releases and hooks
ref(*): code simplification
ref(hapi): move chart package out of hapi
ref(chart): add requirements and lock to Chart struct
2018-08-24 11:28:29 -07:00
Renamed from pkg/chartutil/load_test.go (Browse further)