From de9ef55ef7467466e13c3dc2dca0f8ca78daa172 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 380548c..41bb53c 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -477,9 +477,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,