From 26c424ccd74193778382a89af92335facb3d95b3 Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Sat, 29 Mar 2025 13:29:56 +0100 Subject: [PATCH 1/2] fix: tart backend stops VM to early --- pkg/tart/vm_darwin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/tart/vm_darwin.go b/pkg/tart/vm_darwin.go index bdeab813..446acea8 100644 --- a/pkg/tart/vm_darwin.go +++ b/pkg/tart/vm_darwin.go @@ -101,7 +101,8 @@ func (vm *VM) Start(ctx context.Context, config Config, _ *Env, customDirectoryM runArgs = append(runArgs, vm.id) - cmd := exec.CommandContext(ctx, tartCommandName, runArgs...) + // Use Background context, because we want to keep the VM running + cmd := exec.CommandContext(context.Background(), tartCommandName, runArgs...) common.Logger(ctx).Debug(strings.Join(runArgs, " ")) From 06966c92f88c7d402197226933ef136917c0cbc7 Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Sat, 29 Mar 2025 17:00:59 +0100 Subject: [PATCH 2/2] wip --- pkg/runner/action.go | 16 ++++++++++++++++ pkg/runner/step_action_remote.go | 1 + 2 files changed, 17 insertions(+) diff --git a/pkg/runner/action.go b/pkg/runner/action.go index fa2707e4..d15632a4 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -1,6 +1,7 @@ package runner import ( + "archive/tar" "context" "embed" "errors" @@ -133,7 +134,22 @@ func maybeCopyToActionDir(ctx context.Context, step actionStep, actionPath strin containerActionDirCopy += `/` } + content, err := rc.JobContainer.GetContainerArchive(ctx, containerActionDirCopy) + if err == nil { + defer content.Close() + if _, err := tar.NewReader(content).Next(); err == nil { + logger.Debugf("Skipping copy because actiondir has been already copied") + return nil + } + } + raction := step.(*stepActionRemote) + defer func() { + raction.copyDone = true + }() + if raction.copyDone { + return nil + } ta, err := rc.getActionCache().GetTarArchive(ctx, raction.cacheDir, raction.resolvedSha, "") if err != nil { return err diff --git a/pkg/runner/step_action_remote.go b/pkg/runner/step_action_remote.go index c2c9dfe9..ca397a27 100644 --- a/pkg/runner/step_action_remote.go +++ b/pkg/runner/step_action_remote.go @@ -27,6 +27,7 @@ type stepActionRemote struct { remoteAction *remoteAction cacheDir string resolvedSha string + copyDone bool } func (sar *stepActionRemote) prepareActionExecutor() common.Executor {