fix windows oci package
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
cdf62f69a1
commit
a21a19a658
@ -7,28 +7,29 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
|
"github.com/containerd/containerd/oci"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const newLine = "\r\n"
|
const newLine = "\r\n"
|
||||||
|
|
||||||
func withExitStatus(es int) SpecOpts {
|
func withExitStatus(es int) oci.SpecOpts {
|
||||||
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
|
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
|
||||||
s.Process.Args = []string{"powershell", "-noprofile", "exit", strconv.Itoa(es)}
|
s.Process.Args = []string{"powershell", "-noprofile", "exit", strconv.Itoa(es)}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func withProcessArgs(args ...string) SpecOpts {
|
func withProcessArgs(args ...string) oci.SpecOpts {
|
||||||
return WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
|
return oci.WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withCat() SpecOpts {
|
func withCat() oci.SpecOpts {
|
||||||
return WithProcessArgs("cmd", "/c", "more")
|
return oci.WithProcessArgs("cmd", "/c", "more")
|
||||||
}
|
}
|
||||||
|
|
||||||
func withTrue() SpecOpts {
|
func withTrue() oci.SpecOpts {
|
||||||
return WithProcessArgs("cmd", "/c")
|
return oci.WithProcessArgs("cmd", "/c")
|
||||||
}
|
}
|
||||||
|
|
||||||
func withExecExitStatus(s *specs.Process, es int) {
|
func withExecExitStatus(s *specs.Process, es int) {
|
||||||
@ -39,8 +40,8 @@ func withExecArgs(s *specs.Process, args ...string) {
|
|||||||
s.Args = append([]string{"powershell", "-noprofile"}, args...)
|
s.Args = append([]string{"powershell", "-noprofile"}, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withImageConfig(i Image) SpecOpts {
|
func withImageConfig(i Image) oci.SpecOpts {
|
||||||
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
|
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
|
||||||
s.Windows.LayerFolders = dockerLayerFolders
|
s.Windows.LayerFolders = dockerLayerFolders
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/platforms"
|
|
||||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
// WithResources sets the provided resources on the spec for task updates
|
// WithResources sets the provided resources on the spec for task updates
|
||||||
func WithResources(resources *specs.WindowsResources) UpdateTaskOpts {
|
func WithResources(resources *specs.WindowsResources) UpdateTaskOpts {
|
||||||
return func(ctx context.Context, client Client, r *UpdateTaskInfo) error {
|
return func(ctx context.Context, client *Client, r *UpdateTaskInfo) error {
|
||||||
r.Resources = resources
|
r.Resources = resources
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user