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
9052898f
Commit
9052898f
authored
Jan 27, 2016
by
vaikas-google
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #190 from jackgr/helm-integration
Added username and password to credentials in client.
parents
812e1210
0db42f3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
9 deletions
+39
-9
dm.go
dm/dm.go
+39
-9
No files found.
dm/dm.go
View file @
9052898f
...
@@ -51,6 +51,8 @@ var (
...
@@ -51,6 +51,8 @@ var (
binary
=
flag
.
String
(
"binary"
,
"../expandybird/expansion/expansion.py"
,
"Path to template expansion binary"
)
binary
=
flag
.
String
(
"binary"
,
"../expandybird/expansion/expansion.py"
,
"Path to template expansion binary"
)
timeout
=
flag
.
Int
(
"timeout"
,
10
,
"Time in seconds to wait for response"
)
timeout
=
flag
.
Int
(
"timeout"
,
10
,
"Time in seconds to wait for response"
)
regex_string
=
flag
.
String
(
"regex"
,
""
,
"Regular expression to filter the templates listed in a template registry"
)
regex_string
=
flag
.
String
(
"regex"
,
""
,
"Regular expression to filter the templates listed in a template registry"
)
username
=
flag
.
String
(
"username"
,
""
,
"Github user name that overrides GITHUB_USERNAME environment variable"
)
password
=
flag
.
String
(
"password"
,
""
,
"Github password that overrides GITHUB_PASSWORD environment variable"
)
apitoken
=
flag
.
String
(
"apitoken"
,
""
,
"Github api token that overrides GITHUB_API_TOKEN environment variable"
)
apitoken
=
flag
.
String
(
"apitoken"
,
""
,
"Github api token that overrides GITHUB_API_TOKEN environment variable"
)
)
)
...
@@ -100,15 +102,9 @@ func getRegistryProvider() registry.RegistryProvider {
...
@@ -100,15 +102,9 @@ func getRegistryProvider() registry.RegistryProvider {
}
}
cp
:=
registry
.
NewInmemCredentialProvider
()
cp
:=
registry
.
NewInmemCredentialProvider
()
if
*
apitoken
==
""
{
credential
:=
getGithubCredential
()
*
apitoken
=
os
.
Getenv
(
"DM_GITHUB_API_TOKEN"
)
if
credential
!=
nil
{
}
if
err
:=
cp
.
SetCredential
(
"default"
,
credential
);
err
!=
nil
{
if
*
apitoken
!=
""
{
credential
:=
common
.
RegistryCredential
{
APIToken
:
common
.
APITokenCredential
(
*
apitoken
),
}
if
err
:=
cp
.
SetCredential
(
"default"
,
&
credential
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"cannot set credential at %s: %s"
,
"default"
,
err
))
panic
(
fmt
.
Errorf
(
"cannot set credential at %s: %s"
,
"default"
,
err
))
}
}
}
}
...
@@ -130,6 +126,40 @@ func newRegistry(URL string) *common.Registry {
...
@@ -130,6 +126,40 @@ func newRegistry(URL string) *common.Registry {
}
}
}
}
func
getGithubCredential
()
*
common
.
RegistryCredential
{
*
apitoken
=
strings
.
TrimSpace
(
*
apitoken
)
if
*
apitoken
==
""
{
*
apitoken
=
strings
.
TrimSpace
(
os
.
Getenv
(
"GITHUB_API_TOKEN"
))
}
if
*
apitoken
!=
""
{
return
&
common
.
RegistryCredential
{
APIToken
:
common
.
APITokenCredential
(
*
apitoken
),
}
}
*
username
=
strings
.
TrimSpace
(
*
username
)
if
*
username
==
""
{
*
username
=
strings
.
TrimSpace
(
os
.
Getenv
(
"GITHUB_USERNAME"
))
}
if
*
username
!=
""
{
*
password
=
strings
.
TrimSpace
(
*
password
)
if
*
password
==
""
{
*
password
=
strings
.
TrimSpace
(
os
.
Getenv
(
"GITHUB_PASSWORD"
))
}
return
&
common
.
RegistryCredential
{
BasicAuth
:
common
.
BasicAuthCredential
{
Username
:
*
username
,
Password
:
*
password
,
},
}
}
return
nil
}
func
getGithubRegistry
()
registry
.
Registry
{
func
getGithubRegistry
()
registry
.
Registry
{
provider
:=
getRegistryProvider
()
provider
:=
getRegistryProvider
()
git
,
err
:=
provider
.
GetRegistryByShortURL
(
*
template_registry
)
git
,
err
:=
provider
.
GetRegistryByShortURL
(
*
template_registry
)
...
...
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