mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Use local cleanup method rather than dependency
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/diff"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/pkg/cleanup"
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
@@ -199,7 +198,7 @@ func (i *ImageService) createDiff(ctx context.Context, name string, sn snapshots
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
defer cleanup.Do(ctx, func(ctx context.Context) {
|
||||
defer cleanup(ctx, func(ctx context.Context) {
|
||||
sn.Remove(ctx, upperKey)
|
||||
})
|
||||
}
|
||||
@@ -210,7 +209,7 @@ func (i *ImageService) createDiff(ctx context.Context, name string, sn snapshots
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
defer cleanup.Do(ctx, func(ctx context.Context) {
|
||||
defer cleanup(ctx, func(ctx context.Context) {
|
||||
sn.Remove(ctx, lowerKey)
|
||||
})
|
||||
|
||||
@@ -303,6 +302,12 @@ func uniquePart() string {
|
||||
return fmt.Sprintf("%d-%s", t.Nanosecond(), base64.URLEncoding.EncodeToString(b[:]))
|
||||
}
|
||||
|
||||
func cleanup(ctx context.Context, do func(context.Context)) {
|
||||
ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second)
|
||||
do(ctx)
|
||||
cancel()
|
||||
}
|
||||
|
||||
// CommitBuildStep is used by the builder to create an image for each step in
|
||||
// the build.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user