From 8f81f40d62a403c3a245a1c450c521205dea44c6 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Thu, 23 Mar 2023 09:41:22 +0800 Subject: [PATCH] Fix failed to create container if the runner works in root dir (#67) Fix #56 This PR uses the `preset.Repository` as a part of the workdir and use `filepath.FromSlash` to convert the slash characters. Co-authored-by: Jason Song Reviewed-on: https://gitea.com/gitea/act_runner/pulls/67 Reviewed-by: Jason Song Co-authored-by: Zettat123 Co-committed-by: Zettat123 --- runtime/task.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/task.go b/runtime/task.go index e854d67..86cde60 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -212,7 +212,9 @@ func (t *Task) Run(ctx context.Context, task *runnerv1.Task, runnerName, runnerV input := t.Input config := &runner.Config{ - Workdir: "." + string(filepath.Separator), + // On Linux, Workdir will be like "//" + // On Windows, Workdir will be like "\\" + Workdir: filepath.FromSlash(string(filepath.Separator) + preset.Repository), BindWorkdir: false, ReuseContainers: false, ForcePull: input.forcePull,