repocli: first version of pull & push image
This commit is contained in:
@@ -88,6 +88,7 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
|
||||
}
|
||||
|
||||
incomingManifestBytes := buffer.Bytes()
|
||||
|
||||
if int64(len(incomingManifestBytes)) != contentLength {
|
||||
err = fmt.Errorf("Mismatch Content-Length and received manifest size: %d vs %d",
|
||||
contentLength, len(incomingManifestBytes))
|
||||
@@ -163,11 +164,14 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
|
||||
if err != nil {
|
||||
return res, http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
// Starting manifest and blobs transaction
|
||||
err = oper.mdb.UpdateManifestWithBlobs(ctx, &incomingManifestDescr, addedBlobDescrs, uselessBlobDescrs)
|
||||
if err != nil {
|
||||
return res, http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
//goto end
|
||||
for _, blob := range uselessBlobDescrs {
|
||||
exists, _, err := oper.store.BlobExists(blob.Digest)
|
||||
if err != nil {
|
||||
@@ -201,6 +205,8 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
|
||||
}
|
||||
}
|
||||
|
||||
//end:
|
||||
|
||||
res.Location = fmt.Sprintf(`/v2/%s/manifests/%s`, params.Name, params.Reference)
|
||||
return res, http.StatusCreated, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user