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
abd33764
Commit
abd33764
authored
Feb 16, 2018
by
Liam White
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix linting bug with charts containing more than one hyphen
parent
c2d9dbd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
lint.go
cmd/helm/lint.go
+5
-1
lint_test.go
cmd/helm/lint_test.go
+14
-5
compressedchart-with-hyphens-0.1.0.tgz
...estdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz
+0
-0
No files found.
cmd/helm/lint.go
View file @
abd33764
...
@@ -149,7 +149,11 @@ func lintChart(path string, vals []byte, namespace string, strict bool) (support
...
@@ -149,7 +149,11 @@ func lintChart(path string, vals []byte, namespace string, strict bool) (support
return
linter
,
err
return
linter
,
err
}
}
base
:=
strings
.
Split
(
filepath
.
Base
(
path
),
"-"
)[
0
]
lastHyphenIndex
:=
strings
.
LastIndex
(
filepath
.
Base
(
path
),
"-"
)
if
lastHyphenIndex
<=
0
{
return
linter
,
fmt
.
Errorf
(
"unable to parse chart archive %q, missing '-'"
,
filepath
.
Base
(
path
))
}
base
:=
filepath
.
Base
(
path
)[
:
lastHyphenIndex
]
chartPath
=
filepath
.
Join
(
tempDir
,
base
)
chartPath
=
filepath
.
Join
(
tempDir
,
base
)
}
else
{
}
else
{
chartPath
=
path
chartPath
=
path
...
...
cmd/helm/lint_test.go
View file @
abd33764
...
@@ -21,11 +21,13 @@ import (
...
@@ -21,11 +21,13 @@ import (
)
)
var
(
var
(
values
=
[]
byte
{}
values
=
[]
byte
{}
namespace
=
"testNamespace"
namespace
=
"testNamespace"
strict
=
false
strict
=
false
archivedChartPath
=
"testdata/testcharts/compressedchart-0.1.0.tgz"
archivedChartPath
=
"testdata/testcharts/compressedchart-0.1.0.tgz"
chartDirPath
=
"testdata/testcharts/decompressedchart/"
archivedChartPathWithHyphens
=
"testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz"
invalidArchivedChartPath
=
"testdata/testcharts/invalidcompressedchart0.1.0.tgz"
chartDirPath
=
"testdata/testcharts/decompressedchart/"
)
)
func
TestLintChart
(
t
*
testing
.
T
)
{
func
TestLintChart
(
t
*
testing
.
T
)
{
...
@@ -37,4 +39,11 @@ func TestLintChart(t *testing.T) {
...
@@ -37,4 +39,11 @@ func TestLintChart(t *testing.T) {
t
.
Errorf
(
"%s"
,
err
)
t
.
Errorf
(
"%s"
,
err
)
}
}
if
_
,
err
:=
lintChart
(
archivedChartPathWithHyphens
,
values
,
namespace
,
strict
);
err
!=
nil
{
t
.
Errorf
(
"%s"
,
err
)
}
if
_
,
err
:=
lintChart
(
invalidArchivedChartPath
,
values
,
namespace
,
strict
);
err
==
nil
{
t
.
Errorf
(
"Expected a chart parsing error"
)
}
}
}
cmd/helm/testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz
0 → 100644
View file @
abd33764
File added
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