Jesse Simpson
013f27c294
fix: use errors.New instead of fmt.Errorf
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
868cdc261f
refactor: reduce flow-control operations
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
48922e21d1
refactor: use struct equality instead of comparing each composition
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
ac98e977c3
refactor: switch to while loop instead of for to reduce unnecessary variables
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
65084371c9
refactor: replace if MatchString with FindStringSubMatch
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
782f6c6409
refactor: shorten regex subexp syntax
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
4b9a9ecaf6
refactor: rename function and add doc-string
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
4f63c73353
refactor: remove impractical safety check
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
5202820f2f
refactor: define regexs at package scope
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
cbdc22128e
refactor: use strings.Builder instead of string concatenation
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
cdcf1bc601
style: remove unnecessary break
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
3cc4cb60ba
refactor: prevent duplicates being inserted rather than post-filtering
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
deea4a0d0e
refactor: remove more unnecessary format calls
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
13b232e061
refactor: make use of regexs for err parsing
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
daf4c34879
fix: use originalErr instead of formatting original error
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
98da3e28b6
fix: add some index checking and fixed a test that relied on type-checking
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
80d7a1b33f
style: make format
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
487f72b822
fix: added protection against while-true condition in unbounded for loop
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
6bb836374b
test: adjusted to make it more meaningful and to pass
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
383a758aec
fix: add quality checks to ensure formatted error doesnt remove important info
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
d8bec4e30f
fix: remove comparison from old error message to new
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
c481470985
style: renamed i variable for consistency
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
2e3f6dce28
fix: save to fileLocation rather than fileLocations[i] which gets overwritten
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
f09bbb8ab8
style: consolidate for loops
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
1357db4db1
style: removed variable only used once
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
a56daca82b
style: use interface functions instead of inline logic
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
87f9e2dc45
style: create String function for TraceableError representing one chunk of a stacktrace
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
6cd0c0082a
fix: split up the multiline errors to be more vertical
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
cc477e9f79
fix: adjust test to not require external chart
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Jesse Simpson
14f902c245
wip: draft at making cleaner stacktraces
...
Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
1 year ago
Justen Stall
280a9ddbdb
Merge branch 'main' into stdlib-errors-2
...
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
1 year ago
Scott Rigby
eb6e240cfe
Merge pull request #30734 from ipaqsa/feature/add-custom-template-funcs
...
feat(pkg/engine): add support for custom template funcs
1 year ago
Benoit Tigeot
e2461de3c2
Fix test with toml bump
...
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
1 year ago
Stepan Paksashvili
b54349d9b2
fix(pkg/engine): allow to override all functions
...
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
1 year ago
Stepan Paksashvili
8982b57e5e
feat(pkg/engine): and custom funcs overriding test
...
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
1 year ago
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>
1 year ago
Matt Farina
7a1eb77e77
Merge pull request #30708 from benoittgt/migrate-kube-pkg-to-slog
...
Migrate pkg to slog
1 year ago
Matt Farina
ed005f5c32
Removing deprecation notice for this function.
...
While the constructor is not used by Helm itself, it is used by SDK
users and there is currently no alternative way to expose this.
Signed-off-by: Matt Farina <matt.farina@suse.com>
1 year ago
Benoit Tigeot
0c85456788
Leverage slog.Any for errors
...
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
1 year ago
Robert Sirchia
c5991028e0
fixing matts changes
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
3a19576377
making changes as requested by matt
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
4422000330
fixing case issues with the logging of my errors
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
848c134e0c
fixing error messages
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
c2e6ed8ae5
fixing build error
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
8887d01791
fixing issues with my PR
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
c36bc25fb1
fixing missing attributes
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
Robert Sirchia
1ad79a2bb7
converting inline log to slog
...
Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
1 year ago
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>
1 year ago
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>
1 year ago
Zhanwei Li
34b679e0cc
feat: Add mustToYaml and mustToJson template functions
...
Introduces two new template functions that marshal data to YAML and
JSON, respectively, and panic on errors. This allows for strict
validation of template output formats.
Signed-off-by: Zhanwei Li <zhanweelee@gmail.com>
1 year ago
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>
2 years ago
Matt Farina
5727f56a96
Update to Go 1.23
...
Multiple changes were made to pass linting. Some Go built-in names
are being used for variables (e.g., min). This happens in the Go
source itself including the Go standard library and is not always
a bad practice.
To handle allowing some built-in names to be used the linter config
is updated to allow (via opt-in) some names to pass. This allows us
to still check for re-use of Go built-in names and opt-in to any
new uses.
There were also several cases where a value was checked for nil
before checking its length when this is already handled by len()
or the types default value. These were cleaned up.
The license validation was updated because it was checking everything
in the .git directory including all remote content that was local.
The previous vendor directory was from a time prior to Go modules
when Helm handled dependencies differently. It was no longer needed.
Signed-off-by: Matt Farina <matt.farina@suse.com>
2 years ago
Justen Stall
63cf42a843
fix: replace "github.com/pkg/errors" with stdlib "errors" package
...
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
2 years ago
Nathan Baulch
ff9dd262e3
Fix typos
...
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2 years ago
Fred Heinecke
30ce031d77
Merge branch 'main' into feat/add-toyamlpretty-1
2 years ago
Joe Julian
1c73ea44ad
Merge remote-tracking branch 'upstream/main' into feat/toml-parsing
...
Signed-off-by: Joe Julian <me@joejulian.name>
2 years ago
fheinecke
e502486109
Merge branch 'main' into feat/add-toyamlpretty-1
...
Signed-off-by: fheinecke <23390735+fheinecke@users.noreply.github.com>
2 years ago
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>
2 years ago
Matt Farina
7fd08041b1
Merge pull request #12617 from porridge/dynamic-client
...
feature(pkg/engine): introduce RenderWithClientProvider
3 years ago
Andrew Block
77d54d7dbe
Merge pull request #11351 from greed42/fast-tpl
...
Speed up `tpl`
3 years ago
Marcin Owsiany
a997de1f11
tests(pkg/engine): test RenderWithClientProvider
...
Signed-off-by: Marcin Owsiany <porridge@redhat.com>
3 years ago
Marcin Owsiany
bfec4ec926
feature(pkg/engine): introduce RenderWithClientProvider
...
Signed-off-by: Marcin Owsiany <porridge@redhat.com>
3 years ago
Fred Heinecke
73f1dcc1d9
Added `toYamlPretty` template function
...
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
3 years ago
Joe Julian
c42fdd1e0b
Merge remote-tracking branch 'upstream/main' into fix3
3 years ago
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>
3 years ago
Graham Reed
36d417de3b
Test update for "Speed up `tpl`"
...
Signed-off-by: Graham Reed <greed@7deadly.org>
3 years ago
Graham Reed
97dbb96f5a
Merge remote-tracking branch 'origin/main' into fast-tpl
...
Signed-off-by: Graham Reed <greed@7deadly.org>
3 years ago
Joe Julian
ca61c326c2
Merge pull request #11758 from joejulian/remove_blank_list_item_from_files_lines
...
strip trailing newline from Files.Lines
3 years ago
Joe Julian
ec1d0d8671
Merge pull request #11456 from greed42/tpl-tests
...
Backfill tests for the `tpl` function
3 years ago
Graham Reed
95905f19dd
Work around template.Clone omitting options
...
Signed-off-by: Graham Reed <greed@7deadly.org>
3 years ago
Graham Reed
f235f0f285
Check that missing keys are still handled in tpl
...
Signed-off-by: Graham Reed <greed@7deadly.org>
3 years ago
Dominik Müller
266ab5af05
test(pkg/engine): add tests for TOML parsing
...
Signed-off-by: Dominik Müller <mail@dominikm.de>
3 years ago
Dominik Müller
f550eda6e9
feat(pkg/engine): add TOML parsing functionality
...
Allows to use `fromToml` in templates similar to `fromJson` or `fromYaml`.
Closes #12024
Signed-off-by: Dominik Müller <mail@dominikm.de>
3 years ago
Joe Julian
b3707e666b
strip trailing newline from Files.Lines
...
Signed-off-by: Joe Julian <me@joejulian.name>
3 years ago
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>
3 years ago
AdamKorcz
2a9594c0fe
pkg/engine: fix nil-dereference
...
Signed-off-by: AdamKorcz <adam@adalogics.com>
3 years ago
Matt Farina
863bc74e5a
Update to func handling
...
Signed-off-by: Matt Farina <matt@mattfarina.com>
4 years ago
Graham Reed
9fe912f3c5
Check redefinition of define and include in tpl
...
Signed-off-by: Graham Reed <greed@7deadly.org>
4 years ago
Graham Reed
ebf5e1e2af
Check that `.Template` is passed through `tpl`
...
Signed-off-by: Graham Reed <greed@7deadly.org>
4 years ago
Graham Reed
0a6e7d95ab
Make sure empty `tpl` values render empty.
...
Signed-off-by: Graham Reed <greed@7deadly.org>
4 years ago
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>
4 years ago
Graham Reed
a7d3fd6c09
Allow a nested `tpl` invocation access to `defines` in a containing one
...
Signed-off-by: Graham Reed <greed@7deadly.org>
4 years ago
Graham Reed
e2a7c7998a
Remove the 'reference templates' concept
...
As we're using `t.Clone()` we already get the right 'references'.
Signed-off-by: Graham Reed <greed@7deadly.org>
4 years ago
cui fliter
09d3f31358
fix a few function names on comments
...
Signed-off-by: cui fliter <imcusg@gmail.com>
4 years ago
Graham Reed
db4f330122
Speed up `tpl`
...
- Use a clone of the current Template instead of re-creating everything from scratch
- Needs to inject `include` so any defines in the tpl text can be seen.
Signed-off-by: Graham Reed <greed@7deadly.org>
4 years ago
Matthew Fisher
aa6e82bac8
fix: use `go install` instead of `go get`
...
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
4 years ago
Matt Farina
f895948ae2
Fixing issue with non-existant .Template when using tpl function
...
This is a regression accidently introduced in #9957 .
A delete call had been used on the Template key of vals. This caused
a condition where Template was not available when rendering via tpl.
The delete happened after ExecuteTemplate so the issue is surpsising.
It may possibly be a race condition. Existing tests did not catch it.
I tried to create a test that directly tested the issue and was
unable to replicate the error seen with real charts. This leads me
to believe it is a race condition in the underlying Go template
package.
The delete call was not there before #9957 . It should be safe to
remove and keep that information.
Closes #10082
Signed-off-by: Matt Farina <matt.farina@suse.com>
5 years ago
Matt Farina
ac80a5eec9
Merge branch 'main' into feat/subcharts-scope
5 years ago
Matt Farina
2de6f9d424
Merge pull request #9993 from Ka0o0/make-isroot-available-to-template
...
Make Chart's IsRoot available to templates
5 years ago
Kai Takac
8fcaf7b85c
Add Chart IsRoot test
...
Signed-off-by: Kai Takac <kai.takac@gmail.com>
5 years ago
Kai Takac
06ae6f933a
Make Chart's IsRoot available to templates
...
Signed-off-by: Kai Takac <kai.takac@gmail.com>
5 years ago
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>
5 years ago
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>
5 years ago
Martin Hickey
dffc2a30c7
Merge pull request #9035 from wizbit/fail-message
...
Fail message is now the same as the required message.
5 years ago
Martin Hickey
699ea6dcef
Merge pull request #9066 from scaat/fix-specification
...
[FIX]Unified go specification
5 years ago
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>
5 years ago
Marcus Speight
7a663a56c2
Fixed Test
...
Signed-off-by: Marcus Speight <marcus.speight@hotmail.co.uk>
Signed-off-by: Marcus Speight <marcus@pmconnect.co.uk>
6 years ago
Marcus Speight
8aa42824f9
Added test for lint mode
...
Signed-off-by: Marcus Speight <marcus.speight@hotmail.co.uk>
6 years ago
Scaat Feng
1852694a65
[FIX]comment should start with whitespace
...
Signed-off-by: Scaat Feng <scaat.feng@gmail.com>
6 years ago
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>
6 years ago