Skip to content

Commit

Permalink
WithRuntimePath uses the TaskInfo.RuntimePath field
Browse files Browse the repository at this point in the history
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
(cherry picked from commit 97064b0)
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
  • Loading branch information
Iceber committed Apr 27, 2023
1 parent 91fd842 commit d2d9eed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...N
})
}
}
request.RuntimePath = info.RuntimePath
if info.Options != nil {
any, err := typeurl.MarshalAny(info.Options)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ type TaskInfo struct {
RootFS []mount.Mount
// Options hold runtime specific settings for task creation
Options interface{}
// RuntimePath is an absolute path that can be used to overwrite path
// to a shim runtime binary.
RuntimePath string

// runtime is the runtime name for the container, and cannot be changed.
runtime string
}

Expand Down
2 changes: 1 addition & 1 deletion task_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func WithRootFS(mounts []mount.Mount) NewTaskOpts {
// instead of resolving it from runtime name.
func WithRuntimePath(absRuntimePath string) NewTaskOpts {
return func(ctx context.Context, client *Client, info *TaskInfo) error {
info.runtime = absRuntimePath
info.RuntimePath = absRuntimePath
return nil
}
}
Expand Down

0 comments on commit d2d9eed

Please sign in to comment.