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
16330853
Commit
16330853
authored
Dec 19, 2016
by
Adam Reese
Committed by
GitHub
Dec 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1710 from bacongobbler/chart-repo-authentication
test(cmd): add unit test for chart backed by basic auth
parents
97db9145
d9346e2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
chart_downloader_test.go
cmd/helm/downloader/chart_downloader_test.go
+23
-0
chart_repository.md
docs/chart_repository.md
+9
-0
No files found.
cmd/helm/downloader/chart_downloader_test.go
View file @
16330853
...
...
@@ -20,6 +20,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"testing"
...
...
@@ -35,6 +36,7 @@ func TestResolveChartRef(t *testing.T) {
}{
{
name
:
"full URL"
,
ref
:
"http://example.com/foo-1.2.3.tgz"
,
expect
:
"http://example.com/foo-1.2.3.tgz"
},
{
name
:
"full URL, HTTPS"
,
ref
:
"https://example.com/foo-1.2.3.tgz"
,
expect
:
"https://example.com/foo-1.2.3.tgz"
},
{
name
:
"full URL, with authentication"
,
ref
:
"http://username:password@example.com/foo-1.2.3.tgz"
,
expect
:
"http://username:password@example.com/foo-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"
},
{
name
:
"reference, testing repo"
,
ref
:
"testing/alpine"
,
expect
:
"http://example.com/alpine-1.2.3.tgz"
},
{
name
:
"reference, version, testing repo"
,
ref
:
"testing/alpine"
,
version
:
"0.2.0"
,
expect
:
"http://example.com/alpine-0.2.0.tgz"
},
...
...
@@ -90,6 +92,27 @@ func TestDownload(t *testing.T) {
if
got
.
String
()
!=
expect
{
t
.
Errorf
(
"Expected %q, got %q"
,
expect
,
got
.
String
())
}
// test with server backed by basic auth
basicAuthSrv
:=
httptest
.
NewServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
username
,
password
,
ok
:=
r
.
BasicAuth
()
if
!
ok
||
username
!=
"username"
&&
password
!=
"password"
{
t
.
Errorf
(
"Expected request to use basic auth and for username == 'username' and password == 'password', got '%v', '%s', '%s'"
,
ok
,
username
,
password
)
}
fmt
.
Fprint
(
w
,
expect
)
}))
defer
basicAuthSrv
.
Close
()
u
,
_
:=
url
.
ParseRequestURI
(
basicAuthSrv
.
URL
)
u
.
User
=
url
.
UserPassword
(
"username"
,
"password"
)
got
,
err
=
download
(
u
.
String
())
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
got
.
String
()
!=
expect
{
t
.
Errorf
(
"Expected %q, got %q"
,
expect
,
got
.
String
())
}
}
func
TestIsTar
(
t
*
testing
.
T
)
{
...
...
docs/chart_repository.md
View file @
16330853
...
...
@@ -268,6 +268,15 @@ $ helm repo list
fantastic-charts https://fantastic-charts.storage.googleapis.com
```
If the charts are backed by HTTP basic authentication, you can also supply the
username and password here:
```
console
$
helm repo add fantastic-charts https://username:password@fantastic-charts.storage.googleapis.com
$
helm repo list
fantastic-charts https://username:password@fantastic-charts.storage.googleapis.com
```
**Note:**
A repository will not be added if it does not contain a valid
`index.yaml`
.
...
...
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