From 739264f541ca216e3064fe0554cd3d2c7fd6e533 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Tue, 11 Jul 2023 12:16:26 +0300 Subject: [PATCH 1/2] lima startup issues fixed Signed-off-by: Avi Deitcher --- pkg/container/lima.yaml | 6 +++--- pkg/container/lima_runner.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/container/lima.yaml b/pkg/container/lima.yaml index 259d70c41..08e387dab 100644 --- a/pkg/container/lima.yaml +++ b/pkg/container/lima.yaml @@ -24,6 +24,6 @@ provision: script: | rm -f $HOME/containerd.sock ln -s /proc/$(cat $XDG_RUNTIME_DIR/containerd-rootless/child_pid)/root/run/containerd/containerd.sock ${HOME}/containerd.sock - - mode: system - script: | - chmod 0755 /etc/cni +- mode: system + script: | + chmod 0755 /etc/cni diff --git a/pkg/container/lima_runner.go b/pkg/container/lima_runner.go index 7e9f8b18d..e8167e784 100644 --- a/pkg/container/lima_runner.go +++ b/pkg/container/lima_runner.go @@ -333,7 +333,7 @@ func (l *lima) start(ctx context.Context, name string, exists bool) error { if !exists { buf = bytes.NewReader(config) - args = append(args, "/dev/stdin") + args = append(args, "-") } return l.limactl(ctx, buf, nil, nil, args...) } From 53f46f972aa3f15c856bbaf3f4435bfe336722bf Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Tue, 11 Jul 2023 12:42:23 +0300 Subject: [PATCH 2/2] fix containerID for lima when tarring up Signed-off-by: Avi Deitcher --- pkg/container/lima_runner.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/container/lima_runner.go b/pkg/container/lima_runner.go index e8167e784..292222dbe 100644 --- a/pkg/container/lima_runner.go +++ b/pkg/container/lima_runner.go @@ -256,8 +256,15 @@ func (l *lima) terminateVM(ctx context.Context, cfg *Config) error { func (l *lima) WorkspaceTar(ctx context.Context, cfg *Config) (io.ReadCloser, error) { pr, pw := io.Pipe() - err := l.nerdctl(ctx, melangeVMName, nil, pw, nil, "exec", "-i", "tar", "cf", "-", "-C", runnerWorkdir, "melange-out") - return pr, err + go func() { + defer pw.Close() + + if err := l.nerdctl(ctx, melangeVMName, nil, pw, nil, "exec", "-i", cfg.PodID, "tar", "cf", "-", "-C", runnerWorkdir, "melange-out"); err != nil { + pw.CloseWithError(fmt.Errorf("failed to tar workspace: %w", err)) + } + }() + + return pr, nil } // these private functions handle some reusable code to avoid duplication.