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
93e1c765
Unverified
Commit
93e1c765
authored
Nov 01, 2017
by
Matthew Fisher
Committed by
GitHub
Nov 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3065 from cjauvin/fix-for-relative-chart-path-support
Fix for relative chart path support in index.yaml
parents
6a05a0a3
8775f632
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
4 deletions
+72
-4
chart_downloader.go
pkg/downloader/chart_downloader.go
+7
-4
chart_downloader_test.go
pkg/downloader/chart_downloader_test.go
+4
-0
testing-relative-index.yaml
...ata/helmhome/repository/cache/testing-relative-index.yaml
+28
-0
testing-relative-trailing-slash-index.yaml
...pository/cache/testing-relative-trailing-slash-index.yaml
+28
-0
repositories.yaml
...downloader/testdata/helmhome/repository/repositories.yaml
+5
-0
No files found.
pkg/downloader/chart_downloader.go
View file @
93e1c765
...
...
@@ -217,12 +217,15 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge
// If the URL is relative (no scheme), prepend the chart repo's base URL
if
!
u
.
IsAbs
()
{
path
:=
u
.
Path
u
,
err
=
url
.
Parse
(
rc
.
URL
)
repoURL
,
err
:=
url
.
Parse
(
rc
.
URL
)
if
err
!=
nil
{
return
u
,
r
.
Client
,
err
return
repoURL
,
r
.
Client
,
err
}
u
.
Path
=
u
.
Path
+
path
q
:=
repoURL
.
Query
()
// We need a trailing slash for ResolveReference to work, but make sure there isn't already one
repoURL
.
Path
=
strings
.
TrimSuffix
(
repoURL
.
Path
,
"/"
)
+
"/"
u
=
repoURL
.
ResolveReference
(
u
)
u
.
RawQuery
=
q
.
Encode
()
return
u
,
r
.
Client
,
err
}
...
...
pkg/downloader/chart_downloader_test.go
View file @
93e1c765
...
...
@@ -44,6 +44,10 @@ func TestResolveChartRef(t *testing.T) {
{
name
:
"reference, version, testing repo"
,
ref
:
"testing/alpine"
,
version
:
"0.2.0"
,
expect
:
"http://example.com/alpine-0.2.0.tgz"
},
{
name
:
"reference, version, malformed repo"
,
ref
:
"malformed/alpine"
,
version
:
"1.2.3"
,
expect
:
"http://dl.example.com/alpine-1.2.3.tgz"
},
{
name
:
"reference, querystring repo"
,
ref
:
"testing-querystring/alpine"
,
expect
:
"http://example.com/alpine-1.2.3.tgz?key=value"
},
{
name
:
"reference, testing-relative repo"
,
ref
:
"testing-relative/foo"
,
expect
:
"http://example.com/helm/charts/foo-1.2.3.tgz"
},
{
name
:
"reference, testing-relative repo"
,
ref
:
"testing-relative/bar"
,
expect
:
"http://example.com/helm/bar-1.2.3.tgz"
},
{
name
:
"reference, testing-relative-trailing-slash repo"
,
ref
:
"testing-relative-trailing-slash/foo"
,
expect
:
"http://example.com/helm/charts/foo-1.2.3.tgz"
},
{
name
:
"reference, testing-relative-trailing-slash repo"
,
ref
:
"testing-relative-trailing-slash/bar"
,
expect
:
"http://example.com/helm/bar-1.2.3.tgz"
},
{
name
:
"full URL, HTTPS, irrelevant version"
,
ref
:
"https://example.com/foo-1.2.3.tgz"
,
version
:
"0.1.0"
,
expect
:
"https://example.com/foo-1.2.3.tgz"
,
fail
:
true
},
{
name
:
"full URL, file"
,
ref
:
"file:///foo-1.2.3.tgz"
,
fail
:
true
},
{
name
:
"invalid"
,
ref
:
"invalid-1.2.3"
,
fail
:
true
},
...
...
pkg/downloader/testdata/helmhome/repository/cache/testing-relative-index.yaml
0 → 100644
View file @
93e1c765
apiVersion
:
v1
entries
:
foo
:
-
name
:
foo
description
:
Foo Chart With Relative Path
engine
:
gotpl
home
:
https://k8s.io/helm
keywords
:
[]
maintainers
:
[]
sources
:
-
https://github.com/kubernetes/charts
urls
:
-
charts/foo-1.2.3.tgz
version
:
1.2.3
checksum
:
0e6661f193211d7a5206918d42f5c2a9470b737d
bar
:
-
name
:
bar
description
:
Bar Chart With Relative Path
engine
:
gotpl
home
:
https://k8s.io/helm
keywords
:
[]
maintainers
:
[]
sources
:
-
https://github.com/kubernetes/charts
urls
:
-
bar-1.2.3.tgz
version
:
1.2.3
checksum
:
0e6661f193211d7a5206918d42f5c2a9470b737d
pkg/downloader/testdata/helmhome/repository/cache/testing-relative-trailing-slash-index.yaml
0 → 100644
View file @
93e1c765
apiVersion
:
v1
entries
:
foo
:
-
name
:
foo
description
:
Foo Chart With Relative Path
engine
:
gotpl
home
:
https://k8s.io/helm
keywords
:
[]
maintainers
:
[]
sources
:
-
https://github.com/kubernetes/charts
urls
:
-
charts/foo-1.2.3.tgz
version
:
1.2.3
checksum
:
0e6661f193211d7a5206918d42f5c2a9470b737d
bar
:
-
name
:
bar
description
:
Bar Chart With Relative Path
engine
:
gotpl
home
:
https://k8s.io/helm
keywords
:
[]
maintainers
:
[]
sources
:
-
https://github.com/kubernetes/charts
urls
:
-
bar-1.2.3.tgz
version
:
1.2.3
checksum
:
0e6661f193211d7a5206918d42f5c2a9470b737d
pkg/downloader/testdata/helmhome/repository/repositories.yaml
View file @
93e1c765
...
...
@@ -12,3 +12,7 @@ repositories:
url
:
"
http://dl.example.com"
-
name
:
testing-querystring
url
:
"
http://example.com?key=value"
-
name
:
testing-relative
url
:
"
http://example.com/helm"
-
name
:
testing-relative-trailing-slash
url
:
"
http://example.com/helm/"
\ 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