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
8ca89cfb
Unverified
Commit
8ca89cfb
authored
Nov 23, 2017
by
Matthew Fisher
Committed by
GitHub
Nov 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3113 from joonix/issue-1639
Walk symbolic link directories
parents
ab46779b
7cc61096
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
3 deletions
+57
-3
load.go
pkg/chartutil/load.go
+38
-3
requirements_test.go
pkg/chartutil/requirements_test.go
+13
-0
Chart.yaml
pkg/chartutil/testdata/joonix/Chart.yaml
+4
-0
frobnitz
pkg/chartutil/testdata/joonix/charts/frobnitz
+2
-0
No files found.
pkg/chartutil/load.go
View file @
8ca89cfb
...
...
@@ -243,7 +243,7 @@ func LoadDir(dir string) (*chart.Chart, error) {
files
:=
[]
*
BufferedFile
{}
topdir
+=
string
(
filepath
.
Separator
)
err
=
filepath
.
Walk
(
topdir
,
func
(
name
string
,
fi
os
.
FileInfo
,
err
error
)
error
{
walk
:=
func
(
name
string
,
fi
os
.
FileInfo
,
err
error
)
error
{
n
:=
strings
.
TrimPrefix
(
name
,
topdir
)
if
n
==
""
{
// No need to process top level. Avoid bug with helmignore .* matching
...
...
@@ -278,10 +278,45 @@ func LoadDir(dir string) (*chart.Chart, error) {
files
=
append
(
files
,
&
BufferedFile
{
Name
:
n
,
Data
:
data
})
return
nil
}
)
if
err
!=
nil
{
}
if
err
=
filepath
.
Walk
(
topdir
,
symWalk
(
topdir
,
""
,
walk
));
err
!=
nil
{
return
c
,
err
}
return
LoadFiles
(
files
)
}
// symWalk walks topdir with optional symbolic link dir, symdir. The symdir will
// be used as the path name sent to walkFn.
func
symWalk
(
topdir
,
symdir
string
,
walkFn
filepath
.
WalkFunc
)
filepath
.
WalkFunc
{
return
func
(
name
string
,
fi
os
.
FileInfo
,
err
error
)
error
{
// Recover the symbolic path instead of the real path.
if
symdir
!=
""
{
relative
,
err
:=
filepath
.
Rel
(
topdir
,
name
)
if
err
!=
nil
{
return
err
}
name
=
filepath
.
Join
(
symdir
,
relative
)
}
// Recursively walk symlinked directories.
if
isSymlink
(
fi
)
{
resolved
,
err
:=
filepath
.
EvalSymlinks
(
name
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error evaluating symlink %s: %s"
,
name
,
err
)
}
if
fi
,
err
=
os
.
Lstat
(
resolved
);
err
!=
nil
{
return
err
}
if
fi
.
IsDir
()
{
return
filepath
.
Walk
(
resolved
,
symWalk
(
resolved
,
name
,
walkFn
))
}
}
return
walkFn
(
name
,
fi
,
err
)
}
}
func
isSymlink
(
fi
os
.
FileInfo
)
bool
{
return
fi
.
Mode
()
&
os
.
ModeSymlink
!=
0
}
pkg/chartutil/requirements_test.go
View file @
8ca89cfb
...
...
@@ -425,6 +425,19 @@ func TestDependentChartWithSubChartsHelmignore(t *testing.T) {
}
}
func
TestDependentChartsWithSubChartsSymlink
(
t
*
testing
.
T
)
{
c
,
err
:=
Load
(
"testdata/joonix"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to load testdata: %s"
,
err
)
}
if
c
.
Metadata
.
Name
!=
"joonix"
{
t
.
Fatalf
(
"Unexpected chart name: %s"
,
c
.
Metadata
.
Name
)
}
if
n
:=
len
(
c
.
Dependencies
);
n
!=
1
{
t
.
Fatalf
(
"Expected 1 dependency for this chart, but got %d"
,
n
)
}
}
func
TestDependentChartsWithSubchartsAllSpecifiedInRequirements
(
t
*
testing
.
T
)
{
c
,
err
:=
Load
(
"testdata/dependent-chart-with-all-in-requirements-yaml"
)
if
err
!=
nil
{
...
...
pkg/chartutil/testdata/joonix/Chart.yaml
0 → 100644
View file @
8ca89cfb
apiVersion
:
v1
description
:
A Helm chart for Kubernetes
name
:
joonix
version
:
1.2.3
pkg/chartutil/testdata/joonix/charts/frobnitz
0 → 120000
View file @
8ca89cfb
../../frobnitz
\ No newline at end of file
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