[FORGEJO] lifetime 0 converts to infinity

Closes: https://code.forgejo.org/forgejo/act/issues/2
(cherry picked from commit 6dc2a8e888)
This commit is contained in:
Earl Warren 2023-03-19 09:06:07 +01:00
parent 2095fba7ea
commit d7fe6c8571
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -472,9 +472,13 @@ func (rc *RunContext) startJobContainer() common.Executor {
return nil return nil
} }
lifetime := fmt.Sprint(rc.Config.ContainerMaxLifetime.Round(time.Second).Seconds())
if lifetime == "0" {
lifetime = "infinity"
}
rc.JobContainer = container.NewContainer(&container.NewContainerInput{ rc.JobContainer = container.NewContainer(&container.NewContainerInput{
Cmd: nil, 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), WorkingDir: ext.ToContainerPath(rc.Config.Workdir),
Image: image, Image: image,
Username: username, Username: username,