Skip to content

Commit

Permalink
Add push for checkpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
crosbymichael committed Sep 4, 2018
1 parent 71cc5d7 commit 74c48c0
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 138 deletions.
21 changes: 12 additions & 9 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,21 @@ func (a *Agent) Rollback(ctx context.Context, req *v1.RollbackRequest) (*v1.Roll
}

func (a *Agent) PushBuild(ctx context.Context, req *v1.PushBuildRequest) (*types.Empty, error) {
return a.Push(ctx, &v1.PushRequest{
Ref: req.Ref,
Build: true,
})
}

func (a *Agent) Push(ctx context.Context, req *v1.PushRequest) (*types.Empty, error) {
if req.Ref == "" {
return nil, errors.New("no ref provided")
}
ctx = namespaces.WithNamespace(ctx, "buildkit")
if req.Build {
ctx = namespaces.WithNamespace(ctx, "buildkit")
} else {
ctx = relayContext(ctx)
}
image, err := a.client.GetImage(ctx, req.Ref)
if err != nil {
return nil, err
Expand Down Expand Up @@ -493,14 +504,6 @@ func (a *Agent) Checkpoint(ctx context.Context, req *v1.CheckpointRequest) (*v1.
if err != nil {
return nil, err
}
// checkpoint the image that is used from the container
image, err := container.Image(ctx)
if err != nil {
return nil, err
}
index.Manifests = append(index.Manifests, image.Target())
index.Annotations["image.name"] = image.Name()
index.Annotations["snapshot.key"] = info.SnapshotKey
err = pauseAndRun(ctx, container, func() error {
// checkpoint rw layer
opts := []diff.Opt{
Expand Down
Loading

0 comments on commit 74c48c0

Please sign in to comment.