feat: auto cleanup of offline runners (#7803)
Some checks failed
/ release (push) Has been cancelled
testing / backend-checks (push) Has been cancelled
testing / frontend-checks (push) Has been cancelled
testing / test-unit (push) Has been cancelled
testing / test-remote-cacher (garnet) (push) Has been cancelled
testing / test-remote-cacher (redict) (push) Has been cancelled
testing / test-mysql (push) Has been cancelled
testing / test-pgsql (push) Has been cancelled
testing / test-sqlite (push) Has been cancelled
testing / test-e2e (push) Has been cancelled
testing / test-remote-cacher (redis) (push) Has been cancelled
testing / test-remote-cacher (valkey) (push) Has been cancelled
testing / security-check (push) Has been cancelled

Fixes #7646

Adds a cron job to cleanup action runners that have been offline or inactive for X amount of time.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7803
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Julian Schlarb <julian.schlarb@denktmit.de>
Co-committed-by: Julian Schlarb <julian.schlarb@denktmit.de>
This commit is contained in:
Julian Schlarb 2025-06-08 00:13:37 +02:00 committed by Gusted
parent 4d44ae39e1
commit 4b6ccbd631
8 changed files with 274 additions and 2 deletions

View file

@ -46,6 +46,13 @@ type CleanupHookTaskConfig struct {
NumberToKeep int
}
// CleanupOfflineRunnersConfig represents a cron task with settings to clean up offline-runner
type CleanupOfflineRunnersConfig struct {
BaseConfig
OlderThan time.Duration
GlobalScopeOnly bool
}
// GetSchedule returns the schedule for the base config
func (b *BaseConfig) GetSchedule() string {
return b.Schedule