Merge pull request #908 from ehazlett/fix-task-info
Updates the execution service to include ContainerID in tasks
diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go
index f473170..c782c88 100644
--- a/cmd/ctr/run.go
+++ b/cmd/ctr/run.go
@@ -241,7 +241,7 @@
}
}
- createContainer, err := newCreateContainerRequest(context, id, id, spec)
+ createContainer, err := newCreateContainerRequest(context, id, id, ref, spec)
if err != nil {
return err
}
diff --git a/cmd/ctr/run_unix.go b/cmd/ctr/run_unix.go
index 23f5c87..448770c 100644
--- a/cmd/ctr/run_unix.go
+++ b/cmd/ctr/run_unix.go
@@ -282,10 +282,11 @@
return json.Marshal(s)
}
-func newCreateContainerRequest(context *cli.Context, id, snapshot string, spec []byte) (*containersapi.CreateContainerRequest, error) {
+func newCreateContainerRequest(context *cli.Context, id, snapshot, image string, spec []byte) (*containersapi.CreateContainerRequest, error) {
create := &containersapi.CreateContainerRequest{
Container: containersapi.Container{
- ID: id,
+ ID: id,
+ Image: image,
Spec: &protobuf.Any{
TypeUrl: specs.Version,
Value: spec,
diff --git a/cmd/ctr/run_windows.go b/cmd/ctr/run_windows.go
index 4112093..7e08c1b 100644
--- a/cmd/ctr/run_windows.go
+++ b/cmd/ctr/run_windows.go
@@ -139,10 +139,11 @@
return json.Marshal(rtSpec)
}
-func newCreateContainerRequest(context *cli.Context, id, snapshot string, spec []byte) (*containersapi.CreateContainerRequest, error) {
+func newCreateContainerRequest(context *cli.Context, id, snapshot, image string, spec []byte) (*containersapi.CreateContainerRequest, error) {
create := &containersapi.CreateContainerRequest{
Container: containersapi.Container{
- ID: id,
+ ID: id,
+ Image: image,
Spec: &protobuf.Any{
TypeUrl: specs.Version,
Value: spec,
diff --git a/linux/task.go b/linux/task.go
index bced436..da761ab 100644
--- a/linux/task.go
+++ b/linux/task.go
@@ -41,6 +41,7 @@
func (c *Task) Info() plugin.TaskInfo {
return plugin.TaskInfo{
+ ID: c.containerID,
ContainerID: c.containerID,
Runtime: runtimeName,
Spec: c.spec,
diff --git a/services/execution/service.go b/services/execution/service.go
index 4a44835..c4db8ef 100644
--- a/services/execution/service.go
+++ b/services/execution/service.go
@@ -220,9 +220,10 @@
log.G(ctx).WithField("status", state.Status()).Warn("unknown status")
}
return &task.Task{
- ID: c.Info().ID,
- Pid: state.Pid(),
- Status: status,
+ ID: c.Info().ID,
+ ContainerID: c.Info().ContainerID,
+ Pid: state.Pid(),
+ Status: status,
Spec: &protobuf.Any{
TypeUrl: specs.Version,
Value: c.Info().Spec,