Send X-Docker-Endpoints header when validating the images upload with the index at the end of a push
This commit is contained in:
parent
e9ef3f43b7
commit
ca71aa4f8d
1 changed files with 7 additions and 2 deletions
|
@ -328,7 +328,7 @@ func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token
|
||||||
return nil
|
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)
|
imgListJSON, err := json.Marshal(imgList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
|
||||||
req.ContentLength = int64(len(imgListJSON))
|
req.ContentLength = int64(len(imgListJSON))
|
||||||
req.Header.Set("X-Docker-Token", "true")
|
req.Header.Set("X-Docker-Token", "true")
|
||||||
|
if validate {
|
||||||
|
req.Header["X-Docker-Endpoints"] = regs
|
||||||
|
}
|
||||||
|
|
||||||
res, err := r.client.Do(req)
|
res, err := r.client.Do(req)
|
||||||
if err != nil {
|
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.SetBasicAuth(r.authConfig.Username, r.authConfig.Password)
|
||||||
req.ContentLength = int64(len(imgListJSON))
|
req.ContentLength = int64(len(imgListJSON))
|
||||||
req.Header.Set("X-Docker-Token", "true")
|
req.Header.Set("X-Docker-Token", "true")
|
||||||
|
if validate {
|
||||||
|
req.Header["X-Docker-Endpoints"] = regs
|
||||||
|
}
|
||||||
res, err = r.client.Do(req)
|
res, err = r.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue