diff options
author | Francesco Antognazza <francesco.antognazza@gmail.com> | 2023-10-02 23:09:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-02 23:09:26 +0200 |
commit | bc21723717a00888722c86641b70371a811867f9 (patch) | |
tree | 31ea636cc61af5e26c604bcd197c06b4cd9b47f8 /modules | |
parent | dfa4e5857fe9d8f113cf50d4c7fda094f0f30b74 (diff) | |
download | gitea-bc21723717a00888722c86641b70371a811867f9.tar.gz gitea-bc21723717a00888722c86641b70371a811867f9.zip |
Make Actions tasks/jobs timeouts configurable by the user (#27400)
With this PR we added the possibility to configure the Actions timeouts
values for killing tasks/jobs.
Particularly this enhancement is closely related to the `act_runner`
configuration reported below:
```
# The timeout for a job to be finished.
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
timeout: 3h
```
---
Setting the corresponding key in the INI configuration file, it is
possible to let jobs run for more than 3 hours.
Signed-off-by: Francesco Antognazza <francesco.antognazza@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/actions.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/setting/actions.go b/modules/setting/actions.go index 28c84f0149..026bab4bfc 100644 --- a/modules/setting/actions.go +++ b/modules/setting/actions.go @@ -6,6 +6,7 @@ package setting import ( "fmt" "strings" + "time" "code.gitea.io/gitea/modules/log" ) @@ -18,6 +19,9 @@ var ( ArtifactRetentionDays int64 `ini:"ARTIFACT_RETENTION_DAYS"` Enabled bool DefaultActionsURL defaultActionsURL `ini:"DEFAULT_ACTIONS_URL"` + ZombieTaskTimeout time.Duration `ini:"ZOMBIE_TASK_TIMEOUT"` + EndlessTaskTimeout time.Duration `ini:"ENDLESS_TASK_TIMEOUT"` + AbandonedJobTimeout time.Duration `ini:"ABANDONED_JOB_TIMEOUT"` }{ Enabled: true, DefaultActionsURL: defaultActionsURLGitHub, @@ -82,5 +86,9 @@ func loadActionsFrom(rootCfg ConfigProvider) error { Actions.ArtifactRetentionDays = 90 } + Actions.ZombieTaskTimeout = sec.Key("ZOMBIE_TASK_TIMEOUT").MustDuration(10 * time.Minute) + Actions.EndlessTaskTimeout = sec.Key("ENDLESS_TASK_TIMEOUT").MustDuration(3 * time.Hour) + Actions.AbandonedJobTimeout = sec.Key("ABANDONED_JOB_TIMEOUT").MustDuration(24 * time.Hour) + return err } |