Merge pull request #46405 from rumpl/image-events

This commit is contained in:
Djordje Lukic 2023-09-06 12:31:35 +02:00 committed by GitHub
commit 2c95ddf4f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -113,6 +113,8 @@ func (i *ImageService) ExportImage(ctx context.Context, names []string, outStrea
"target": target,
}).Debug("export image without name")
}
i.LogImageEvent(target.Digest.String(), target.Digest.String(), events.ActionSave)
}
return i.client.Export(ctx, outStream, opts...)

View file

@ -11,6 +11,7 @@ import (
"github.com/containerd/containerd/pkg/snapshotters"
"github.com/containerd/containerd/platforms"
"github.com/distribution/reference"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/streamformatter"
@ -88,5 +89,8 @@ func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string,
// error to not mark the pull as failed.
logger.WithError(err).Warn("unexpected error while removing outdated dangling image reference")
}
i.LogImageEvent(reference.FamiliarString(ref), reference.FamiliarName(ref), events.ActionPull)
return nil
}

View file

@ -16,6 +16,7 @@ import (
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker"
"github.com/distribution/reference"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/progress"
@ -147,6 +148,9 @@ func (i *ImageService) PushImage(ctx context.Context, targetRef reference.Named,
}
}
if err == nil {
i.LogImageEvent(reference.FamiliarString(targetRef), reference.FamiliarName(targetRef), events.ActionPush)
}
return err
}