- Registry: Send X-Docker-Endpoints at the end of a push
| ... | ... |
@@ -328,7 +328,7 @@ func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token |
| 328 | 328 |
return nil |
| 329 | 329 |
} |
| 330 | 330 |
|
| 331 |
-func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool) (*RepositoryData, error) {
|
|
| 331 |
+func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error) {
|
|
| 332 | 332 |
imgListJSON, err := json.Marshal(imgList) |
| 333 | 333 |
if err != nil {
|
| 334 | 334 |
return nil, err |
| ... | ... |
@@ -347,6 +347,9 @@ func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validat |
| 347 | 347 |
req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password) |
| 348 | 348 |
req.ContentLength = int64(len(imgListJSON)) |
| 349 | 349 |
req.Header.Set("X-Docker-Token", "true")
|
| 350 |
+ if validate {
|
|
| 351 |
+ req.Header["X-Docker-Endpoints"] = regs |
|
| 352 |
+ } |
|
| 350 | 353 |
|
| 351 | 354 |
res, err := r.client.Do(req) |
| 352 | 355 |
if err != nil {
|
| ... | ... |
@@ -364,7 +367,9 @@ func (r *Registry) PushImageJSONIndex(remote string, imgList []*ImgData, validat |
| 364 | 364 |
req.SetBasicAuth(r.authConfig.Username, r.authConfig.Password) |
| 365 | 365 |
req.ContentLength = int64(len(imgListJSON)) |
| 366 | 366 |
req.Header.Set("X-Docker-Token", "true")
|
| 367 |
- |
|
| 367 |
+ if validate {
|
|
| 368 |
+ req.Header["X-Docker-Endpoints"] = regs |
|
| 369 |
+ } |
|
| 368 | 370 |
res, err = r.client.Do(req) |
| 369 | 371 |
if err != nil {
|
| 370 | 372 |
return nil, err |
| ... | ... |
@@ -497,7 +497,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri |
| 497 | 497 |
srvName = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
|
| 498 | 498 |
} |
| 499 | 499 |
|
| 500 |
- repoData, err := r.PushImageJSONIndex(srvName, imgList, false) |
|
| 500 |
+ repoData, err := r.PushImageJSONIndex(srvName, imgList, false, nil) |
|
| 501 | 501 |
if err != nil {
|
| 502 | 502 |
return err |
| 503 | 503 |
} |
| ... | ... |
@@ -521,7 +521,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri |
| 521 | 521 |
} |
| 522 | 522 |
} |
| 523 | 523 |
|
| 524 |
- if _, err := r.PushImageJSONIndex(srvName, imgList, true); err != nil {
|
|
| 524 |
+ if _, err := r.PushImageJSONIndex(srvName, imgList, true, repoData.Endpoints); err != nil {
|
|
| 525 | 525 |
return err |
| 526 | 526 |
} |
| 527 | 527 |
return nil |