|
@@ -829,8 +829,6 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
|
return fmt.Errorf("Multipart upload for build is no longer supported. Please upgrade your docker client.")
|
|
return fmt.Errorf("Multipart upload for build is no longer supported. Please upgrade your docker client.")
|
|
}
|
|
}
|
|
var (
|
|
var (
|
|
- authEncoded = r.Header.Get("X-Registry-Auth")
|
|
|
|
- authConfig = ®istry.AuthConfig{}
|
|
|
|
configFileEncoded = r.Header.Get("X-Registry-Config")
|
|
configFileEncoded = r.Header.Get("X-Registry-Config")
|
|
configFile = ®istry.ConfigFile{}
|
|
configFile = ®istry.ConfigFile{}
|
|
job = eng.Job("build")
|
|
job = eng.Job("build")
|
|
@@ -840,14 +838,22 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
|
// Both headers will be parsed and sent along to the daemon, but if a non-empty
|
|
// Both headers will be parsed and sent along to the daemon, but if a non-empty
|
|
// ConfigFile is present, any value provided as an AuthConfig directly will
|
|
// ConfigFile is present, any value provided as an AuthConfig directly will
|
|
// be overridden. See BuildFile::CmdFrom for details.
|
|
// be overridden. See BuildFile::CmdFrom for details.
|
|
|
|
+ // /*
|
|
|
|
+ var (
|
|
|
|
+ authEncoded = r.Header.Get("X-Registry-Auth")
|
|
|
|
+ authConfig = ®istry.AuthConfig{}
|
|
|
|
+ )
|
|
if version.LessThan("1.9") && authEncoded != "" {
|
|
if version.LessThan("1.9") && authEncoded != "" {
|
|
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
|
|
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
|
|
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
|
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
|
|
// for a pull it is not an error if no auth was given
|
|
// for a pull it is not an error if no auth was given
|
|
// to increase compatibility with the existing api it is defaulting to be empty
|
|
// to increase compatibility with the existing api it is defaulting to be empty
|
|
authConfig = ®istry.AuthConfig{}
|
|
authConfig = ®istry.AuthConfig{}
|
|
|
|
+ } else {
|
|
|
|
+ configFile.Configs[authConfig.ServerAddress] = *authConfig
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // */
|
|
|
|
|
|
if configFileEncoded != "" {
|
|
if configFileEncoded != "" {
|
|
configFileJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(configFileEncoded))
|
|
configFileJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(configFileEncoded))
|
|
@@ -870,7 +876,6 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
|
|
job.Setenv("q", r.FormValue("q"))
|
|
job.Setenv("q", r.FormValue("q"))
|
|
job.Setenv("nocache", r.FormValue("nocache"))
|
|
job.Setenv("nocache", r.FormValue("nocache"))
|
|
job.Setenv("rm", r.FormValue("rm"))
|
|
job.Setenv("rm", r.FormValue("rm"))
|
|
- job.SetenvJson("authConfig", authConfig)
|
|
|
|
job.SetenvJson("configFile", configFile)
|
|
job.SetenvJson("configFile", configFile)
|
|
|
|
|
|
if err := job.Run(); err != nil {
|
|
if err := job.Run(); err != nil {
|