Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
70b29a47
Commit
70b29a47
authored
Oct 14, 2016
by
Matt Butcher
Committed by
GitHub
Oct 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1368 from prydonius/1367-fix-linter-tmpl-regex
fix(lint): validateNoMissingValues template regex
parents
789e411d
aed4db02
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
template.go
pkg/lint/rules/template.go
+11
-6
No files found.
pkg/lint/rules/template.go
View file @
70b29a47
...
...
@@ -71,11 +71,11 @@ func Templates(linter *support.Linter) {
}
/* Iterate over all the templates to check:
- It is a .yaml file
- All the values in the template file is defined
- {{}} include | quote
- Generated content is a valid Yaml file
- Metadata.Namespace is not set
- It is a .yaml file
- All the values in the template file is defined
- {{}} include | quote
- Generated content is a valid Yaml file
- Metadata.Namespace is not set
*/
for
_
,
template
:=
range
chart
.
Templates
{
fileName
,
preExecutedTemplate
:=
template
.
Name
,
template
.
Data
...
...
@@ -154,12 +154,17 @@ func validateNoMissingValues(templatesPath string, chartValues chartutil.Values,
// 2 - Extract every function and execute them against the loaded values
// Supported {{ .Chart.Name }}, {{ .Chart.Name | quote }}
r
,
_
:=
regexp
.
Compile
(
`{{[\w
|\.|\s|\|\"|\'
]+}}`
)
r
,
_
:=
regexp
.
Compile
(
`{{[\w
.\s|"'-
]+}}`
)
functions
:=
r
.
FindAllString
(
string
(
templateContent
),
-
1
)
skipRegex
,
_
:=
regexp
.
Compile
(
`if|else|end`
)
// Iterate over the {{ FOO }} templates, executing them against the chartValues
// We do individual templates parsing so we keep the reference for the key (str) that we want it to be interpolated.
for
_
,
str
:=
range
functions
{
if
skipRegex
.
MatchString
(
str
)
{
continue
}
newtmpl
,
err
:=
tmpl
.
Parse
(
str
)
if
err
!=
nil
{
return
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment