Commit graph

57 commits

Author SHA1 Message Date
Matt Farina
c5249c1f8d
Revert "fix (helm) : toToml` renders int as float [ backport to v3 ]"
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.

Closes #30880

Signed-off-by: Matt Farina <matt@mattfarina.com>
2025-05-20 16:17:23 -04:00
Matt Farina
3ce10e4f81
Unarchiving fix
Signed-off-by: Matt Farina <matt@mattfarina.com>
(cherry picked from commit 7cc4dcf94ee410c8e0d64f3e726dda199c24ccb2)
2025-04-09 09:23:13 -04:00
Althaf M
0a6834fdf0 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>
2024-12-14 23:19:01 +00: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
Oleg Sidorov
ec440d446d Replaced ghodss/yaml with sigs.k8s.io/yaml
This commit replaces usage of github.com/ghodss/yaml with it's forked
version maintained by SIG community. The replaced library has
low-to-none support activity unlike the latter. We believe the new
Helm branch could benefit from using the community-supported version on
a long-term run as yaml parser is a key component of Helm chart rendering
engine.

This commit locks sigs.k8s.io/yaml dependency version on 1.1.0 which
is backwards compatible with ghodss/yaml 1.0.0.

This change also resolves the outdated dependency version lock for
ghodss/yaml (currently 1.0.0) and makes it possible to port changes from
https://github.com/helm/helm/pull/6010 to dev-v3.

Signed-off-by: Oleg Sidorov <oleg.sidorov@booking.com>
2019-07-12 16:52:15 +02: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
45f63628e1
ref(pkg/chart): remove unused chart.RawValues
Signed-off-by: Adam Reese <adam@reese.io>
2019-05-16 11:03:21 -07: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
Matthew Fisher
5367c6c296
fix(loader): assume apiVersion is v1 when loading charts
In Helm 2, no chart validation was performed on v1 charts, so there are
a few charts out there that never added an apiVersion to the Chart.yaml.
To ensure those charts continue to work for Helm 3, we should assume
that charts loaded without an apiVersion set should be assumed as v1.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-05-14 11:00:20 -07:00
Matt Farina
250b63eced
Updating the labels for consistency
Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-05-07 14:13:29 -04: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
295092cd7d
ref(pkg/action): refactoring dup code and linter fixes
Signed-off-by: Adam Reese <adam@reese.io>
2019-03-26 11:11:27 -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