mirror of
https://github.com/docker/cli.git
synced 2026-01-16 20:22:36 +03:00
Merge pull request #868 from dotcloud/postupload-endpoints-header
- Registry: Send X-Docker-Endpoints at the end of a push Upstream-commit: 05b87d2d5b87c606818f5dcc10e466a355cf1630 Component: engine
This commit is contained in:
@@ -328,7 +328,7 @@ func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool) (*RepositoryData, error) {
|
||||
func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error) {
|
||||
imgListJSON, err := json.Marshal(imgList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -347,6 +347,9 @@ func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validat
|
||||
req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
|
||||
req.ContentLength = int64(len(imgListJSON))
|
||||
req.Header.Set("X-Docker-Token", "true")
|
||||
if validate {
|
||||
req.Header["X-Docker-Endpoints"] = regs
|
||||
}
|
||||
|
||||
res, err := r.client.Do(req)
|
||||
if err != nil {
|
||||
@@ -364,7 +367,9 @@ func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validat
|
||||
req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
|
||||
req.ContentLength = int64(len(imgListJSON))
|
||||
req.Header.Set("X-Docker-Token", "true")
|
||||
|
||||
if validate {
|
||||
req.Header["X-Docker-Endpoints"] = regs
|
||||
}
|
||||
res, err = r.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -497,7 +497,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
|
||||
srvName = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
|
||||
}
|
||||
|
||||
repoData, err := r.PushImageJSONIndex(srvName, imgList, false)
|
||||
repoData, err := r.PushImageJSONIndex(srvName, imgList, false, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -521,7 +521,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := r.PushImageJSONIndex(srvName, imgList, true); err != nil {
|
||||
if _, err := r.PushImageJSONIndex(srvName, imgList, true, repoData.Endpoints); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user