Commit graph

67 commits

Author SHA1 Message Date
Mads Jensen
a490bb3c20 Use errors.Is to check for io.EOF and gzip.ErrHeader
In GoLang, using the == operator to check for a certain error will not
unwrap the error chain, and therefore may hide the problem.

Signed-off-by: Mads Jensen <atombrella@users.noreply.github.com>
2025-12-14 08:54:11 +01:00
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
ca8eae9361
Reproducible chart archive builds
Building the same chart into an archive multiple times will have
the same sha256 hash.

Perviously, the time in the headers for a file was time.Now() which
changed each time. The time is now collected from the operating
system when the file is loaded and this time is used.

Fixes: #3612

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-10-29 11:49:22 -04:00
Matt Farina
8dc7c57f50
Update the action interfaces for chart apiversions
This change is about handling the interfaces to public functions for
different chart apiVersions. The internals are still focused on v2.
This enables v3 to be layered in layer.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-09-17 15:19:02 -04: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
91cd72d0e4 fix: improve LoadValues function documentation
Signed-off-by: lubingtan <bingtanlu@gmail.com>
2025-02-20 08:08:20 +08:00
lubingtan
fb7221bc9a fix: add doc for func MergeMaps
Signed-off-by: lubingtan <bingtanlu@gmail.com>
2025-02-20 08:08:20 +08: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
Althaf M
88f7dc5329 merge: fixing merge conflicts
Signed-off-by: Althaf M althafm@outlook.com
Signed-off-by: Althaf M <althafm@outlook.com>
2025-01-22 09:32:47 +00:00
Althaf M
10d267ed8b fix: (toToml) renders int as float
This commit fixes the issue where the yaml.Unmarshaller converts all int values into float64, this passes in option to decoder,
which enables conversion of int into .
Signed-off-by: Althaf M <althafm@outlook.com>
2025-01-22 09:32:47 +00: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
Taylor Jasko
6f2f7d4781 Updating subchart load error to be more descriptive
In the event some malformed folders/files make its way into the
`charts/` directory meant for subcharts, it is possible one may see an
error message like the below:
```
Error: error unpacking foo in app: Chart.yaml file is missing
```

This error is not very descriptive, as it doesn't reference where on
disk `Chart.yaml` is missing. In the event this happens, this error is
being updated to include that `Chart.yaml` is missing for the `foo`
subchart.

Without this updated error messaging, one would need to look into Helm's
codebase to troubleshoot what exactly is wrong.

Signed-off-by: Taylor Jasko <taylor@taylorjasko.com>
2024-11-06 17:40:18 -06:00
Nathan Baulch
ef85fa7f2d
Grammar fixes
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-14 10:30:31 +10:00
Matt Farina
c16b1c9f2b
Merge pull request #12867 from aauren/add_requirements.lock_warning
feat(load.go): add warning on requirements.lock
2024-05-15 08:58:28 -04:00
Aaron U'Ren
29ab5c4b02 feat(load.go): add warning on requirements.lock
Signed-off-by: Aaron U'Ren <aauren@users.noreply.github.com>
2024-03-11 19:54:13 -05:00
Robert Sirchia
d58d7b3762 Fixing all the linting errors
Cleaned up all the linting errors we are getting.

Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-03-11 17:13:34 -04:00
Ismail Alidzhikov
5586760133 Make the ignore pkg public again
Signed-off-by: Ismail Alidzhikov <i.alidjikov@gmail.com>
2023-12-22 09:14:12 +02:00
MR ZHAO
5c7a63138b
Fix helm may identify achieve of the application/x-gzip as application/vnd.ms-fontobject
Signed-off-by: MR ZHAO <62738635+heijian123@users.noreply.github.com>
2023-08-07 09:48:04 +08: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
a374fffdd9
Merge pull request #8948 from gy-lehel/#7696
Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-11-10 14:32:26 -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
Lehel Gyuro
27807e1bb5 [#7696] Avoid crash in chart loader on unexpected file sequence
Make sure, that chart metadata is initialized by the time the processing
of the chart is started.

Signed-off-by: Lehel Gyuro <lehel@freemail.hu>
2020-10-28 08:02:55 +01:00
Lehel Gyuro
8abb44f218 [#7696] Avoid crash in chart loader on unexpected file sequence
Make sure, that chart metadata is initialized by the time the processing
of the chart is started.

Signed-off-by: Lehel Gyuro <lehel@freemail.hu>
2020-10-27 22:29:54 +01: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
Zhengyi Lai
ebf6d7e5b2
Bugfix: panic when chart contains requirements.lock
Signed-off-by: Zhengyi Lai <zheng1@yunify.com>
2020-07-25 09:54:00 +08:00
Matt Farina
512544b9ab
Fixing PAX Header handling (#8086)
* Fixing issue with PAX headers in plugin archive

PAX Headers can be added by some systems that create archives. Helm
should ignore them when extracting.

There are two PAX headers. One is global and the other is not. Both
are ignored. The test adds only the PAX global header because the
Go tar package is unable to write the header that is not global.

Closes #8084

Signed-off-by: Matt Farina <matt@mattfarina.com>

* Removing the PAX header test as it is not working

The PAX header test was making a WriteHeader call and ignoring the
error. When writing the type TypeXHeader it was causing an error
that was being silently ignored. The Go tar package cannot write
this type and produces an error when one tries to. The error reads
"cannot manually encode TypeXHeader, TypeGNULongName, or TypeGNULongLink
headers"

Signed-off-by: Matt Farina <matt@mattfarina.com>

* Adding check of returned error in test

Adding a check for the returned error to make sure a non-nil value
is not returned.

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-05-13 17:09:27 -05: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
Paul "TBBle" Hampson
0cb0eaca94 fix(*): Helm v3 handling of APIVersion v1 charts dependencies (#7009)
* Include requirements.* as Files in APIVersionV1

Fixes #6974.

This ensures that when reading a Chart marked with APIVersion v1, we
maintain the behaviour of Helm v2 and include the requirements.yaml and
requirements.lock in the Files collection, and hence produce charts that
work correctly with Helm v2.

Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>

* Write out requirements.lock for APIVersion1 Charts

This keeps the on-disk format consistent after `helm dependency update`
of an APIVersion1 Chart.

Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>

* Exclude 'dependencies' from APVersion1 Chart.yaml

This fixes `helm lint` against an APIVersion1 chart packaged with Helm
v3.

Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>

* Generate APIVersion v2 charts for dependency tests

As the generated chart contains no requirements.yaml in its files list,
but has dependencies in its metadata, it is not a valid APIVersion v1
chart.

Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>

* Generate APIVersion v2 charts for manager tests

Specifically for the charts that have dependencies, the generated chart
contains no requirements.yaml in its files but has dependencies in its
metadata. Hence it is not a valid APIVersion v1 chart.

Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
2019-12-11 17:07:05 +00:00
Geoff Baskwill
b8605c8d36 test(pkg): add unit tests for tar file edge cases
Adding unit tests for an issue that has come up multiple times
where the archive processing code doesn't take into account the
`tar.TypeXHeader` / `tar.TypeXGlobalHeader` entries that GitHub
adds when creating a release archive for a chart, for example
`https://github.com/org/repo/master.tar.gz`.

Signed-off-by: Geoff Baskwill <me@geoffbaskwill.ca>
2019-11-28 12:52:57 -05:00
chloel
48704034a9 fix: ignore pax header files in chart validation
Signed-off-by: chloel <chloeleeq@gmail.com>
2019-11-27 11:32:04 -05: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
Sidharth Surana
8f833fed25 Fix the ordering of the APIVersion check to avoid nil pointer
Signed-off-by: Sidharth Surana <ssurana@vmware.com>
2019-10-15 22:43:33 -07:00
Martin Hickey
1cc2ad0061
Port #5298 to Helm v3 (#6613)
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2019-10-11 16:19:26 +01: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
Taylor Thomas
c9c95ea148 ref(*): Moves packages to internal
These packages are generally used only for logic inside of Helm and
can later be re-exported as needed

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-08-09 16:02:33 -06:00
Martin Hickey
8f8b2c10e5 Remove the chart lock file as its v1 structure
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2019-08-02 16:01:23 +01: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
Matthew Fisher
4f6d002d6c
chore(docs): move docs to helm-www
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-07-22 12:15:35 -07:00