Revert "refactor build job to know only configFile"

This reverts commit b9731bccf2.

Conflicts:
	server/server.go

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux
2014-05-07 22:59:13 +00:00
parent 331e77f9ed
commit 2aff119baa
4 changed files with 28 additions and 26 deletions

View File

@@ -872,6 +872,8 @@ 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.")
}
var (
authEncoded = r.Header.Get("X-Registry-Auth")
authConfig = &registry.AuthConfig{}
configFileEncoded = r.Header.Get("X-Registry-Config")
configFile = &registry.ConfigFile{}
job = eng.Job("build")
@@ -881,22 +883,14 @@ 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
// ConfigFile is present, any value provided as an AuthConfig directly will
// be overridden. See BuildFile::CmdFrom for details.
// /*
var (
authEncoded = r.Header.Get("X-Registry-Auth")
authConfig = &registry.AuthConfig{}
)
if version.LessThan("1.9") && authEncoded != "" {
authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
// 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
authConfig = &registry.AuthConfig{}
} else {
configFile.Configs[authConfig.ServerAddress] = *authConfig
}
}
// */
if configFileEncoded != "" {
configFileJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(configFileEncoded))
@@ -919,6 +913,7 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
job.Setenv("q", r.FormValue("q"))
job.Setenv("nocache", r.FormValue("nocache"))
job.Setenv("rm", r.FormValue("rm"))
job.SetenvJson("authConfig", authConfig)
job.SetenvJson("configFile", configFile)
if err := job.Run(); err != nil {