Commit Graph

87 Commits

Author SHA1 Message Date
Jesse Simpson 14f902c245
wip: draft at making cleaner stacktraces
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
2025-04-24 19:16:09 -04:00
Stepan Paksashvili b54349d9b2 fix(pkg/engine): allow to override all functions
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
2025-04-18 10:29:56 +03:00
Stepan Paksashvili 8982b57e5e feat(pkg/engine): and custom funcs overriding test
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
2025-04-18 10:29:56 +03:00
Stepan Paksashvili 9073bcf53e feat(pkg/engine): add support for custom template funcs
Enhances the template engine and action config to allow users to inject custom template functions via an action config when using Helm as a library.

Closes #30733

Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
2025-04-18 10:29:56 +03: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
Matt Farina 5c0deec327
Moving chartutil to chart/util
chartutil was originally created to operate on protobufs which are
no longer part of Helm. The util package makes more sense to be
part of the chart package.

This change is part of the HIP 20 to create v3 charts and
explicitly call out v2 charts. The changes for this are in smaller
bite size changes.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-21 15:25:55 -05: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
Joe Julian 1c73ea44ad
Merge remote-tracking branch 'upstream/main' into feat/toml-parsing
Signed-off-by: Joe Julian <me@joejulian.name>
2024-09-12 08:48:58 -07:00
Matt Farina 7fd08041b1
Merge pull request #12617 from porridge/dynamic-client
feature(pkg/engine): introduce RenderWithClientProvider
2024-01-08 21:30:59 -05:00
Marcin Owsiany a997de1f11 tests(pkg/engine): test RenderWithClientProvider
Signed-off-by: Marcin Owsiany <porridge@redhat.com>
2024-01-03 12:04:20 +01:00
Graham Reed b261a1b1be Test update for "Allow a nested `tpl` invocation access to `defines` in a containing one"
Signed-off-by: Graham Reed <greed@7deadly.org>
2023-08-01 00:49:26 +01:00
Graham Reed 36d417de3b Test update for "Speed up `tpl`"
Signed-off-by: Graham Reed <greed@7deadly.org>
2023-08-01 00:49:26 +01:00
Joe Julian ec1d0d8671
Merge pull request #11456 from greed42/tpl-tests
Backfill tests for the `tpl` function
2023-07-12 17:21:07 -07:00
Graham Reed f235f0f285 Check that missing keys are still handled in tpl
Signed-off-by: Graham Reed <greed@7deadly.org>
2023-05-11 22:16:30 +01:00
Dominik Müller 266ab5af05 test(pkg/engine): add tests for TOML parsing
Signed-off-by: Dominik Müller <mail@dominikm.de>
2023-04-25 14:07:13 +02:00
Matt Farina 863bc74e5a
Update to func handling
Signed-off-by: Matt Farina <matt@mattfarina.com>
2023-02-03 15:36:32 -05:00
Graham Reed 9fe912f3c5 Check redefinition of define and include in tpl
Signed-off-by: Graham Reed <greed@7deadly.org>
2022-10-20 16:25:36 +01:00
Graham Reed ebf5e1e2af Check that `.Template` is passed through `tpl`
Signed-off-by: Graham Reed <greed@7deadly.org>
2022-10-20 16:25:36 +01:00
Graham Reed 0a6e7d95ab Make sure empty `tpl` values render empty.
Signed-off-by: Graham Reed <greed@7deadly.org>
2022-10-20 16:25:36 +01:00
Graham Reed d1e9a242a7 Pick the test improvement out of PR#8371
<https://github.com/helm/helm/pull/8371>

This covers:
  - `tpl` text can `include` a `define` provided in a partial file
  - `tpl` text can `include` a `define` provided in its text
  - `tpl` text can be loaded via `.Files.Get`

Signed-off-by: Graham Reed <greed@7deadly.org>
2022-10-20 16:25:09 +01:00
Matt Farina ac80a5eec9
Merge branch 'main' into feat/subcharts-scope 2021-08-25 10:18:31 -04:00
Matt Farina 2de6f9d424
Merge pull request #9993 from Ka0o0/make-isroot-available-to-template
Make Chart's IsRoot available to templates
2021-08-25 10:14:05 -04:00
Kai Takac 8fcaf7b85c Add Chart IsRoot test
Signed-off-by: Kai Takac <kai.takac@gmail.com>
2021-08-23 20:10:37 +02:00
Cory Snider 79df3926f6 fix(engine): parse fail messages with newlines
The templating engine handles errors originating from the `required` and
`fail` template functions specially, cleaning up the error messages to
be more presentable to users. Go's text/template package unfortunately
does not make this straightforward to implement. Despite
template.ExecError implementing Unwrap, the error value returned from
the template function cannot be retrieved using errors.As. The wrapped
error in ExecError is a pre-formatted error string with the template
function's error string interpolated in with the original error value
erased. Helm works around this limitation by delimiting the
template-supplied message and extracting the message out of the
ExecError string with a regex.

Fix the parsing of `required` and `fail` error messages containing
newlines by setting the regex flag to make `.` match newline characters.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2021-08-10 12:38:43 -04:00
Valentin Flaux 3daaea0a1c feat(pkg/engine): expose subcharts scope in parent
Expose the scope (.Values, .Charts, .Releases etc.) of subcharts to the parent scope.

Signed-off-by: Valentin Flaux <vflaux@oui.sncf>
2021-07-20 12:24:27 +02:00
Martin Hickey dffc2a30c7
Merge pull request #9035 from wizbit/fail-message
Fail message is now the same as the required message.
2021-06-02 12:26:39 +01:00
Josh Soref 2bf8fdf45d
chore: Spelling (#9410)
* spelling: annotate

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

* spelling: asserts

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

* spelling: behavior

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

* spelling: binary

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

* spelling: contain

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

* spelling: copied

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

* spelling: dependency

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

* spelling: depending

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

* spelling: deprecated

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

* spelling: doesn't

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

* spelling: donot

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

* spelling: github

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

* spelling: inputting

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

* spelling: iteration

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

* spelling: jabberwocky

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

* spelling: kubernetes

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

* spelling: length

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

* spelling: mismatch

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

* spelling: multiple

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

* spelling: nonexistent

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

* spelling: outputs

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

* spelling: panicking

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

* spelling: plugins

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

* spelling: parsing

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

* spelling: porthos

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

* spelling: regular

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

* spelling: resource

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

* spelling: repositories

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

* spelling: something

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

* spelling: strict

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

* spelling: string

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

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-15 21:11:57 -04:00
Marcus Speight 7a663a56c2 Fixed Test
Signed-off-by: Marcus Speight <marcus.speight@hotmail.co.uk>
Signed-off-by: Marcus Speight <marcus@pmconnect.co.uk>
2020-12-07 14:58:40 +00:00
Marcus Speight 8aa42824f9 Added test for lint mode
Signed-off-by: Marcus Speight <marcus.speight@hotmail.co.uk>
2020-12-02 18:24:00 +00:00
Marcus Speight 7a0739a863 Fail message is now the same as the required message.
Fixed #8973 Helm function 'fail' should not fail when doing 'helm lint'

Signed-off-by: Marcus Speight <marcus.speight@hotmail.co.uk>
2020-11-19 08:10:38 +00:00
Matt Butcher bb47286f09
fix linting error with lookup function (#7969)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-04-22 10:09:34 -06:00
Andre Sencioles d0726e07ab
Parse reference templates in predictable order (#7702)
* Parse reference templates in predictable order

Fix issue #7701

Signed-off-by: Andre Sencioles <asenci@gmail.com>

* Add test case for issue #7701 regression

Signed-off-by: Andre Sencioles <asenci@gmail.com>

* gofmt

Signed-off-by: Andre Sencioles <asenci@gmail.com>
2020-04-21 13:16:55 -06:00
Daniel Cheng 206d4a9053 add test for template recursion
Signed-off-by: Daniel Cheng <dcheng@us.ibm.com>
2020-02-10 12:25:41 -05:00
海的澜色 750b870aed fix stack overflow error (#7114)
* fixed #7111

Signed-off-by: zwwhdls <zwwhdls@hotmail.com>

* update error message

Signed-off-by: zwwhdls <zwwhdls@hotmail.com>

* add test case

Signed-off-by: zwwhdls <zwwhdls@hotmail.com>

* fix lint error

Signed-off-by: zwwhdls <zwwhdls@hotmail.com>
2019-12-02 14:57:51 +00: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
Ian Howell 31b940a61d fix(engine): Fix eating too many colons during template execution
This fixes #6044, in which error parsing is greedily eating too many
colons, preventing users from using colons in their warning messages to
the `required` function

Signed-off-by: Ian Howell <ian.howell0@gmail.com>
2019-07-23 11:33:03 -05:00
Thomas O'Donnell 213f714604 Stop Lint from breaking when using required
Have updated the required filter so that it doesn't break when linting a
chart. This work is based off #4221 and #4748 which didn't make it into
the v3 branch.

Signed-off-by: Thomas O'Donnell <andy.tom@gmail.com>
2019-06-13 20:32:37 +02:00
Ian Howell 278594fb0f fix(pkg/engine): Style changes on template errors
Signed-off-by: Ian Howell <ian.howell0@gmail.com>
2019-04-09 12:34:13 -05:00
Ian Howell 33b1ede570 fix(pkg/engine): Clean up template error messages
Signed-off-by: Ian Howell <ian.howell0@gmail.com>
2019-04-08 16:48:21 -05: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 849f27d11f
ref(pkg/engine): make template specific functions private
Make template specific functions private to ensure they not misused and
make unit tests simpler.  We may export the template helpers later if
needed.

This lays the foundation for the new chart pipeline.

Signed-off-by: Adam Reese <adam@reese.io>
2019-03-06 15:45:52 -08:00
Adam Reese d841a1b1d9
fix(engine): make template rendering thread safe
See https://github.com/helm/helm/pull/4828

Signed-off-by: Adam Reese <adam@reese.io>
2019-03-05 12:56:39 -08:00
Adam Reese 2b81eea1e2
ref(*): replace byte array with map for Release config
Signed-off-by: Adam Reese <adam@reese.io>
2018-12-04 15:57:24 -08: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
Adam Reese 4c95185164
ref(*): replace chart.config with []byte 2018-04-20 00:13:19 -07:00
Adam Reese 36536d77ba
ref(*): remove protobuf any type 2018-04-18 16:28:50 -07:00
Adam Reese 6345f04190
ref(hapi): convert protobuf to go types 2018-04-18 14:53:38 -07:00
Lukas Eichler 8bc7dede18
fix(helm): Apply PR comments for tpl template name fix
Modified existing unit test to verify the changed behavior.
Removed debug print.
2017-12-03 17:39:51 +01:00