From d7fe6c85715c116d128e4e980c96e1d19aa502df Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 19 Mar 2023 09:06:07 +0100 Subject: [PATCH] [FORGEJO] lifetime 0 converts to infinity Closes: https://code.forgejo.org/forgejo/act/issues/2 (cherry picked from commit 6dc2a8e8880e80689a7b8d61f1d5376c5775927a) --- pkg/runner/run_context.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index aa0023f..9bbddd9 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -472,9 +472,13 @@ func (rc *RunContext) startJobContainer() common.Executor { return nil } + lifetime := fmt.Sprint(rc.Config.ContainerMaxLifetime.Round(time.Second).Seconds()) + if lifetime == "0" { + lifetime = "infinity" + } rc.JobContainer = container.NewContainer(&container.NewContainerInput{ Cmd: nil, - Entrypoint: []string{"/bin/sleep", fmt.Sprint(rc.Config.ContainerMaxLifetime.Round(time.Second).Seconds())}, + Entrypoint: []string{"/bin/sleep", lifetime}, WorkingDir: ext.ToContainerPath(rc.Config.Workdir), Image: image, Username: username,