Commit 3587092a authored by Tomasz Maczukin's avatar Tomasz Maczukin

Merge branch 'docker-credentials-helper-support' into 'master'

Docker Credentials helper support

See merge request !1386
parents 0a4ed62a 0199e1f1
Pipeline #64807997 passed with stages
in 85 minutes and 56 seconds
......@@ -107,14 +107,20 @@ func ReadAuthConfigsFromReader(r io.Reader) (map[string]types.AuthConfig, error)
addAll(auths, authsFromCredentialsStore)
}
if config.CredentialHelpers != nil {
authsFromCredentialsHelpers, err := readAuthConfigsFromCredentialsHelper(config)
if err != nil {
return nil, err
}
addAll(auths, authsFromCredentialsHelpers)
}
return auths, nil
}
func readAuthConfigsFromCredentialsStore(config *configfile.ConfigFile) (map[string]types.AuthConfig, error) {
store := credentials.NewNativeStore(config, config.CredentialsStore)
newAuths, err := store.GetAll()
if err != nil {
return nil, err
}
......@@ -122,6 +128,23 @@ func readAuthConfigsFromCredentialsStore(config *configfile.ConfigFile) (map[str
return newAuths, nil
}
func readAuthConfigsFromCredentialsHelper(config *configfile.ConfigFile) (map[string]types.AuthConfig, error) {
helpersAuths := make(map[string]types.AuthConfig)
for registry, helper := range config.CredentialHelpers {
store := credentials.NewNativeStore(config, helper)
newAuths, err := store.Get(registry)
if err != nil {
return nil, err
}
helpersAuths[registry] = newAuths
}
return helpersAuths, nil
}
func addAll(to, from map[string]types.AuthConfig) {
for reg, ac := range from {
to[reg] = ac
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment