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
e03d605b
Commit
e03d605b
authored
Mar 30, 2017
by
Taylor Thomas
Committed by
GitHub
Mar 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2194 from qwangrepos/bug-2103
fix(helm): local path in requirements.yaml relative to working dir
parents
b7af2e21
e6b79e13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
24 deletions
+30
-24
manager.go
pkg/downloader/manager.go
+2
-15
resolver.go
pkg/resolver/resolver.go
+26
-7
resolver_test.go
pkg/resolver/resolver_test.go
+2
-2
No files found.
pkg/downloader/manager.go
View file @
e03d605b
...
...
@@ -325,14 +325,7 @@ func (m *Manager) getRepoNames(deps []*chartutil.Dependency) (map[string]string,
for
_
,
dd
:=
range
deps
{
// if dep chart is from local path, verify the path is valid
if
strings
.
HasPrefix
(
dd
.
Repository
,
"file://"
)
{
depPath
,
err
:=
filepath
.
Abs
(
strings
.
TrimPrefix
(
dd
.
Repository
,
"file://"
))
if
err
!=
nil
{
return
nil
,
err
}
if
_
,
err
=
os
.
Stat
(
depPath
);
os
.
IsNotExist
(
err
)
{
return
nil
,
fmt
.
Errorf
(
"directory %s not found"
,
depPath
)
}
else
if
err
!=
nil
{
if
_
,
err
:=
resolver
.
GetLocalPath
(
dd
.
Repository
,
m
.
ChartPath
);
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -537,17 +530,11 @@ func tarFromLocalDir(chartpath string, name string, repo string, version string)
return
""
,
fmt
.
Errorf
(
"wrong format: chart %s repository %s"
,
name
,
repo
)
}
origPath
,
err
:=
filepath
.
Abs
(
strings
.
TrimPrefix
(
repo
,
"file://"
)
)
origPath
,
err
:=
resolver
.
GetLocalPath
(
repo
,
chartpath
)
if
err
!=
nil
{
return
""
,
err
}
if
_
,
err
=
os
.
Stat
(
origPath
);
os
.
IsNotExist
(
err
)
{
return
""
,
fmt
.
Errorf
(
"directory %s not found: %s"
,
origPath
,
err
)
}
else
if
err
!=
nil
{
return
""
,
err
}
ch
,
err
:=
chartutil
.
LoadDir
(
origPath
)
if
err
!=
nil
{
return
""
,
err
...
...
pkg/resolver/resolver.go
View file @
e03d605b
...
...
@@ -58,14 +58,8 @@ func (r *Resolver) Resolve(reqs *chartutil.Requirements, repoNames map[string]st
missing
:=
[]
string
{}
for
i
,
d
:=
range
reqs
.
Dependencies
{
if
strings
.
HasPrefix
(
d
.
Repository
,
"file://"
)
{
depPath
,
err
:=
filepath
.
Abs
(
strings
.
TrimPrefix
(
d
.
Repository
,
"file://"
))
if
err
!=
nil
{
return
nil
,
err
}
if
_
,
err
=
os
.
Stat
(
depPath
);
os
.
IsNotExist
(
err
)
{
return
nil
,
fmt
.
Errorf
(
"directory %s not found"
,
depPath
)
}
else
if
err
!=
nil
{
if
_
,
err
:=
GetLocalPath
(
d
.
Repository
,
r
.
chartpath
);
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -136,3 +130,28 @@ func HashReq(req *chartutil.Requirements) (string, error) {
s
,
err
:=
provenance
.
Digest
(
bytes
.
NewBuffer
(
data
))
return
"sha256:"
+
s
,
err
}
// GetLocalPath generates absolute local path when use
// "file://" in repository of requirements
func
GetLocalPath
(
repo
string
,
chartpath
string
)
(
string
,
error
)
{
var
depPath
string
var
err
error
p
:=
strings
.
TrimPrefix
(
repo
,
"file://"
)
// root path is absolute
if
strings
.
HasPrefix
(
p
,
"/"
)
{
if
depPath
,
err
=
filepath
.
Abs
(
p
);
err
!=
nil
{
return
""
,
err
}
}
else
{
depPath
=
filepath
.
Join
(
chartpath
,
p
)
}
if
_
,
err
=
os
.
Stat
(
depPath
);
os
.
IsNotExist
(
err
)
{
return
""
,
fmt
.
Errorf
(
"directory %s not found"
,
depPath
)
}
else
if
err
!=
nil
{
return
""
,
err
}
return
depPath
,
nil
}
pkg/resolver/resolver_test.go
View file @
e03d605b
...
...
@@ -81,12 +81,12 @@ func TestResolve(t *testing.T) {
name
:
"repo from valid local path"
,
req
:
&
chartutil
.
Requirements
{
Dependencies
:
[]
*
chartutil
.
Dependency
{
{
Name
:
"signtest"
,
Repository
:
"file://../../cmd/helm/testdata/testcharts/signtest"
,
Version
:
"0.1.0"
},
{
Name
:
"signtest"
,
Repository
:
"file://../../
../../
cmd/helm/testdata/testcharts/signtest"
,
Version
:
"0.1.0"
},
},
},
expect
:
&
chartutil
.
RequirementsLock
{
Dependencies
:
[]
*
chartutil
.
Dependency
{
{
Name
:
"signtest"
,
Repository
:
"file://../../cmd/helm/testdata/testcharts/signtest"
,
Version
:
"0.1.0"
},
{
Name
:
"signtest"
,
Repository
:
"file://../../
../../
cmd/helm/testdata/testcharts/signtest"
,
Version
:
"0.1.0"
},
},
},
},
...
...
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