Merge pull request #45259 from rumpl/c8d-load-save-events

c8d: Send event when an image is imported
This commit is contained in:
Sebastiaan van Stijn 2023-04-03 20:05:45 +02:00 committed by GitHub
commit 816cd9802f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -102,8 +102,6 @@ func (i *ImageService) ExportImage(ctx context.Context, names []string, outStrea
// LoadImage uploads a set of images into the repository. This is the
// complement of ExportImage. The input stream is an uncompressed tar
// ball containing images and metadata.
//
// TODO(thaJeztah): produce JSON stream progress response and image events; see https://github.com/moby/moby/issues/43910
func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
// TODO(vvoland): Allow user to pass platform
platform := cplatforms.All
@ -153,7 +151,9 @@ func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outSt
}
fmt.Fprintf(progress, "Loaded image: %s\n", name)
i.LogImageEvent(img.Target.Digest.String(), img.Target.Digest.String(), "load")
}
return nil
}

View file

@ -146,6 +146,8 @@ func (i *ImageService) ImportImage(ctx context.Context, ref reference.Named, pla
err = i.unpackImage(ctx, img, *platform)
if err != nil {
logger.WithError(err).Debug("failed to unpack image")
} else {
i.LogImageEvent(id.String(), id.String(), "import")
}
return id, err