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
7d9a6509
Unverified
Commit
7d9a6509
authored
Sep 19, 2019
by
Taylor Thomas
Committed by
GitHub
Sep 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6258 from daixiang0/fix-stable
fix issue when dependency not in cache
parents
47ee5385
05d5ff47
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
21 deletions
+41
-21
chart_downloader.go
pkg/downloader/chart_downloader.go
+5
-0
manager.go
pkg/downloader/manager.go
+16
-3
manager_test.go
pkg/downloader/manager_test.go
+8
-8
resolver.go
pkg/resolver/resolver.go
+12
-1
resolver_test.go
pkg/resolver/resolver_test.go
+0
-9
No files found.
pkg/downloader/chart_downloader.go
View file @
7d9a6509
...
...
@@ -205,6 +205,11 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge
}
c
.
setCredentials
(
r
)
// Skip if dependency not contain name
if
len
(
r
.
Config
.
Name
)
==
0
{
return
u
,
r
.
Client
,
nil
}
// Next, we need to load the index, and actually look up the chart.
i
,
err
:=
repo
.
LoadIndexFile
(
c
.
HelmHome
.
CacheIndex
(
r
.
Config
.
Name
))
if
err
!=
nil
{
...
...
pkg/downloader/manager.go
View file @
7d9a6509
...
...
@@ -233,7 +233,7 @@ func (m *Manager) downloadAll(deps []*chartutil.Dependency) error {
// Any failure to resolve/download a chart should fail:
// https://github.com/kubernetes/helm/issues/1439
churl
,
username
,
password
,
err
:=
findChartURL
(
dep
.
Name
,
dep
.
Version
,
dep
.
Repository
,
repos
)
churl
,
username
,
password
,
err
:=
m
.
findChartURL
(
dep
.
Name
,
dep
.
Version
,
dep
.
Repository
,
repos
)
if
err
!=
nil
{
saveError
=
fmt
.
Errorf
(
"could not find %s: %s"
,
churl
,
err
)
break
...
...
@@ -403,9 +403,17 @@ func (m *Manager) getRepoNames(deps []*chartutil.Dependency) (map[string]string,
}
}
if
!
found
{
missing
=
append
(
missing
,
dd
.
Repository
)
repository
:=
dd
.
Repository
// Add if URL
_
,
err
:=
url
.
ParseRequestURI
(
repository
)
if
err
==
nil
{
reposMap
[
repository
]
=
repository
continue
}
missing
=
append
(
missing
,
repository
)
}
}
if
len
(
missing
)
>
0
{
errorMessage
:=
fmt
.
Sprintf
(
"no repository definition for %s. Please add them via 'helm repo add'"
,
strings
.
Join
(
missing
,
", "
))
// It is common for people to try to enter "stable" as a repository instead of the actual URL.
...
...
@@ -424,6 +432,7 @@ repository, use "https://kubernetes-charts.storage.googleapis.com/" or "@stable"
}
return
nil
,
errors
.
New
(
errorMessage
)
}
return
reposMap
,
nil
}
...
...
@@ -475,7 +484,7 @@ func (m *Manager) parallelRepoUpdate(repos []*repo.Entry) error {
// repoURL is the repository to search
//
// If it finds a URL that is "relative", it will prepend the repoURL.
func
findChartURL
(
name
,
version
,
repoURL
string
,
repos
map
[
string
]
*
repo
.
ChartRepository
)
(
url
,
username
,
password
string
,
err
error
)
{
func
(
m
*
Manager
)
findChartURL
(
name
,
version
,
repoURL
string
,
repos
map
[
string
]
*
repo
.
ChartRepository
)
(
url
,
username
,
password
string
,
err
error
)
{
for
_
,
cr
:=
range
repos
{
if
urlutil
.
Equal
(
repoURL
,
cr
.
Config
.
URL
)
{
var
entry
repo
.
ChartVersions
...
...
@@ -497,6 +506,10 @@ func findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRep
return
}
}
url
,
err
=
repo
.
FindChartInRepoURL
(
repoURL
,
name
,
version
,
""
,
""
,
""
,
m
.
Getters
)
if
err
==
nil
{
return
}
err
=
fmt
.
Errorf
(
"chart %s not found in %s"
,
name
,
repoURL
)
return
}
...
...
pkg/downloader/manager_test.go
View file @
7d9a6509
...
...
@@ -78,7 +78,7 @@ func TestFindChartURL(t *testing.T) {
version
:=
"0.1.0"
repoURL
:=
"http://example.com/charts"
churl
,
username
,
password
,
err
:=
findChartURL
(
name
,
version
,
repoURL
,
repos
)
churl
,
username
,
password
,
err
:=
m
.
findChartURL
(
name
,
version
,
repoURL
,
repos
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -106,13 +106,6 @@ func TestGetRepoNames(t *testing.T) {
err
bool
expectedErr
string
}{
{
name
:
"no repo definition failure"
,
req
:
[]
*
chartutil
.
Dependency
{
{
Name
:
"oedipus-rex"
,
Repository
:
"http://example.com/test"
},
},
err
:
true
,
},
{
name
:
"no repo definition failure -- stable repo"
,
req
:
[]
*
chartutil
.
Dependency
{
...
...
@@ -128,6 +121,13 @@ func TestGetRepoNames(t *testing.T) {
err
:
true
,
expectedErr
:
"no 'repository' field specified for dependency:
\"
dependency-missing-repository-field
\"
"
,
},
{
name
:
"dependency repository is url but not exist in repos"
,
req
:
[]
*
chartutil
.
Dependency
{
{
Name
:
"oedipus-rex"
,
Repository
:
"http://example.com/test"
},
},
expect
:
map
[
string
]
string
{
"http://example.com/test"
:
"http://example.com/test"
},
},
{
name
:
"no repo definition failure"
,
req
:
[]
*
chartutil
.
Dependency
{
...
...
pkg/resolver/resolver.go
View file @
7d9a6509
...
...
@@ -71,7 +71,18 @@ func (r *Resolver) Resolve(reqs *chartutil.Requirements, repoNames map[string]st
return
nil
,
fmt
.
Errorf
(
"dependency %q has an invalid version/constraint format: %s"
,
d
.
Name
,
err
)
}
repoIndex
,
err
:=
repo
.
LoadIndexFile
(
r
.
helmhome
.
CacheIndex
(
repoNames
[
d
.
Name
]))
// repo does not exist in cache but has url info
cacheRepoName
:=
repoNames
[
d
.
Name
]
if
cacheRepoName
==
""
&&
d
.
Repository
!=
""
{
locked
[
i
]
=
&
chartutil
.
Dependency
{
Name
:
d
.
Name
,
Repository
:
d
.
Repository
,
Version
:
d
.
Version
,
}
continue
}
repoIndex
,
err
:=
repo
.
LoadIndexFile
(
r
.
helmhome
.
CacheIndex
(
cacheRepoName
))
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"no cached repo found. (try 'helm repo update'). %s"
,
err
)
}
...
...
pkg/resolver/resolver_test.go
View file @
7d9a6509
...
...
@@ -37,15 +37,6 @@ func TestResolve(t *testing.T) {
},
err
:
true
,
},
{
name
:
"cache index failure"
,
req
:
&
chartutil
.
Requirements
{
Dependencies
:
[]
*
chartutil
.
Dependency
{
{
Name
:
"oedipus-rex"
,
Repository
:
"http://example.com"
,
Version
:
"1.0.0"
},
},
},
err
:
true
,
},
{
name
:
"chart not found failure"
,
req
:
&
chartutil
.
Requirements
{
...
...
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