WithRuntimePath uses the TaskInfo.RuntimePath field
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
		| @@ -281,6 +281,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...N | |||||||
| 			}) | 			}) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	request.RuntimePath = info.RuntimePath | ||||||
| 	if info.Options != nil { | 	if info.Options != nil { | ||||||
| 		any, err := typeurl.MarshalAny(info.Options) | 		any, err := typeurl.MarshalAny(info.Options) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								task.go
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								task.go
									
									
									
									
									
								
							| @@ -139,6 +139,11 @@ type TaskInfo struct { | |||||||
| 	RootFS []mount.Mount | 	RootFS []mount.Mount | ||||||
| 	// Options hold runtime specific settings for task creation | 	// Options hold runtime specific settings for task creation | ||||||
| 	Options interface{} | 	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 | 	runtime string | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ func WithRootFS(mounts []mount.Mount) NewTaskOpts { | |||||||
| // instead of resolving it from runtime name. | // instead of resolving it from runtime name. | ||||||
| func WithRuntimePath(absRuntimePath string) NewTaskOpts { | func WithRuntimePath(absRuntimePath string) NewTaskOpts { | ||||||
| 	return func(ctx context.Context, client *Client, info *TaskInfo) error { | 	return func(ctx context.Context, client *Client, info *TaskInfo) error { | ||||||
| 		info.runtime = absRuntimePath | 		info.RuntimePath = absRuntimePath | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Iceber Gu
					Iceber Gu