Commit graph

105 commits

Author SHA1 Message Date
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
Mike Tougeron
804e07300b Render the CRDs to spec files
Signed-off-by: Mike Tougeron <tougeron@adobe.com>
2020-01-20 13:31:26 -08: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
668f51bfdf
fix(chart): add JSON tags to chart object
Go capitalizes field names by default.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-11-01 14:50:32 -07: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