Commit graph

113 commits

Author SHA1 Message Date
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
Matt Farina
e2c7986f30
Merge pull request #13534 from althmoha/dev-v3-12987
fix (helm) : toToml` renders int as float [ backport to v3 ]
2025-02-05 15:33:56 -05:00
Niladri Halder
7321579092 Add annotations and dependencies to get metadata output
The output of helm get metadata includes a subset of the fields contained in
the chart.Metadata struct. This change adds the values of the annotations field
and the dependencies field to the output.

Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
2024-12-27 08:11:15 -08: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
Matt Farina
2da76a06e7
Merge pull request #13345 from AdamKorcz/fuzzzzz2
add chart fuzz tests
2024-10-04 21:47:32 +02:00
Adam Korczynski
e432f39ea7 add chart fuzz tests
Signed-off-by: Adam Korczynski <adam@adalogics.com>
2024-09-20 10:31:48 +01: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
Matt Farina
8e6a5149d2
validation fix
Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-02-07 10:54:15 -05:00
Matt Farina
83a76cea6a
Merge pull request #9176 from dastrobu/#9169/lint-dependency-shadowing
lint and validate dependency metadata to reference dependencies with …
2024-01-08 15:56:29 -05: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
Joe Julian
126333c525
Merge remote-tracking branch 'upstream/main' into #9169/lint-dependency-shadowing 2023-08-24 12:27:33 -07: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
Daniel Strobusch
6a4035aea2 lint and validate dependency metadata to reference dependencies with a unique key (name or alias)
Report charts with the following bad dependency specifications as bad charts:

    dependencies:
    - name: foo
      alias: baz # ← baz used twice
      version: 1.0.0
    - name: bar
      alias: baz # ← baz used twice
      version: 1.0.0

    dependencies:
    - name: foo
      alias: bar # ← shadows chart below
      version: 1.0.0
    - name: bar
      version: 1.0.0

    dependencies:
    - name: foo
      version: 1.0.0
    - name: foo # ← chart with same name as above (although version or repo will be different, this will not work currently)
      version: 1.2.3

Closes #9169

Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
2023-05-23 09:03:22 +02: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
Matt Farina
50c22ed7f9
Bump the Go version
Needed to gofmt source to meet changes in style

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:29:26 -04:00
Daniel Strobusch
6a5f240e9a
change linting error messages for null values in arrays
Closes #11627

Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
2023-01-05 18:28:14 +01:00
wujunwei
4fcec24d15 update: Optimize the error message
Signed-off-by: wujunwei <wjw3323@live.com>
2022-09-24 12:56:03 +08:00
wujunwei
a7a1117327 add nil judge for dependency , maintainers validate and some testcase.
Signed-off-by: wujunwei <wjw3323@live.com>
2022-09-24 12:56:03 +08: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
Adam Reese
657ce552cb
fix(*): Validate metadata semver and printable characters
ref: https://github.com/helm/helm/security/advisories/GHSA-c38g-469g-cmgx

* Skip invalid chart versions when reading the repository index file or
  when programmatically adding a chart version.
* Adds semver validation and strips non-printable characters and
  normalizes spaces for string fields in Metadata.Validate()
* Fixes a unit test that was pulling a remote repo.  Now uses a local
  repo.
* Fixes ignored error in repo update command

Signed-off-by: Adam Reese <adam@reese.io>
2021-02-04 12:52:24 -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
Matt Butcher
59d5b94d35
Merge pull request from GHSA-9vp5-m38w-j776 2020-09-17 12:31:23 -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
Matt Farina
2139e82c68
Merge pull request #7972 from IppX/bug/6081-bom-in-resource-file
Remove utf-8 BOM when loading chart files and helmignore
2020-04-28 10:46:09 -04:00
Hu Shuai
6bc4a948be Add unit test for pkg/chart/chart.go
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-04-27 14:19:02 +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
Matthew Fisher
0e10757a3c
Merge pull request #7854 from q384566678/add-metadata-test
add unit test for metadata Validate
2020-04-13 20:47:51 -07:00
Zhou Hao
20c7909756 add unit test for metadata Validate
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-04-14 11:29:34 +08:00
Zhou Hao
b439d34a43 add unit test for ChartFullPath
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-04-14 10:43:50 +08:00
Zhou Hao
a3d3fa3964 add unit test for ChartPath
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-04-14 10:43:50 +08:00
Zhou Hao
8c55de3818 add unit test for IsRoot
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-04-14 10:43:50 +08:00
Hu Shuai
9ab40a26af Add unit test for pkg/chart/chart.go
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-04-01 16:05:56 +08:00
Matt Farina
ed80cf4548
Fixes issue where non-CRDs are read in from the crd directory
For example, a readme markdown is read in and parsed

Closes #7536

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-02-07 11:24:05 -05:00
Mike Tougeron
e78402d559 fix conflicts
Signed-off-by: Mike Tougeron <tougeron@adobe.com>
2020-02-04 13:16:51 -08:00
Jon Huhn
d70b50b3a1
Fix typo
Signed-off-by: Jon Huhn <huhnjon@gmail.com>
2020-01-30 09:50:59 -06:00
Mike Tougeron
93adb35af1 maintain backwards compatibility in the api for the CRDs function
Signed-off-by: Mike Tougeron <tougeron@adobe.com>
2020-01-27 14:06:06 -08:00