diff --git a/api.go b/api.go index fb59f5efd3..bd8e53d655 100644 --- a/api.go +++ b/api.go @@ -905,15 +905,17 @@ func postBuild(srv *Server, version float64, w http.ResponseWriter, r *http.Requ if version < 1.3 { return fmt.Errorf("Multipart upload for build is no longer supported. Please upgrade your docker client.") } - remoteURL := r.FormValue("remote") - repoName := r.FormValue("t") - rawSuppressOutput := r.FormValue("q") - rawNoCache := r.FormValue("nocache") - rawRm := r.FormValue("rm") - repoName, tag := utils.ParseRepositoryTag(repoName) - - authEncoded := r.Header.Get("X-Registry-Auth") - authConfig := &auth.AuthConfig{} + var ( + remoteURL = r.FormValue("remote") + repoName = r.FormValue("t") + rawSuppressOutput = r.FormValue("q") + rawNoCache = r.FormValue("nocache") + rawRm = r.FormValue("rm") + authEncoded = r.Header.Get("X-Registry-Auth") + authConfig = &auth.AuthConfig{} + tag string + ) + repoName, tag = utils.ParseRepositoryTag(repoName) if authEncoded != "" { authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded)) if err := json.NewDecoder(authJson).Decode(authConfig); err != nil { diff --git a/integration/buildfile_test.go b/integration/buildfile_test.go index 242bf9f412..4d15031d30 100644 --- a/integration/buildfile_test.go +++ b/integration/buildfile_test.go @@ -266,7 +266,7 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u } dockerfile := constructDockerfile(context.dockerfile, ip, port) - buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false)) + buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, useCache, false, ioutil.Discard, utils.NewStreamFormatter(false), nil) id, err := buildfile.Build(mkTestContext(dockerfile, context.files, t)) if err != nil { return nil, err @@ -516,7 +516,7 @@ func TestForbiddenContextPath(t *testing.T) { } dockerfile := constructDockerfile(context.dockerfile, ip, port) - buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false)) + buildfile := docker.NewBuildFile(srv, ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil) _, err = buildfile.Build(mkTestContext(dockerfile, context.files, t)) if err == nil { @@ -562,7 +562,7 @@ func TestBuildADDFileNotFound(t *testing.T) { } dockerfile := constructDockerfile(context.dockerfile, ip, port) - buildfile := docker.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false)) + buildfile := docker.NewBuildFile(mkServerFromEngine(eng, t), ioutil.Discard, ioutil.Discard, false, true, false, ioutil.Discard, utils.NewStreamFormatter(false), nil) _, err = buildfile.Build(mkTestContext(dockerfile, context.files, t)) if err == nil {