From 5a6ac121183d6453b717f664524b53b693b1f606 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Tue, 12 Aug 2025 09:21:43 +0000 Subject: [PATCH] Fix for gitea tools and scale set cleanup Filter out gitea tools to only consider archived downloads. This should help in situations where bandwidth is more important than CPU time used to unarchive the tools. Also a drive by fix for scale sets cleanup. Signed-off-by: Gabriel Adrian Samfira --- doc/events.md | 4 +++- workers/cache/gitea_tools.go | 4 ++++ workers/scaleset/scaleset.go | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/events.md b/doc/events.md index 6bc61a9d..e643a5c2 100644 --- a/doc/events.md +++ b/doc/events.md @@ -88,7 +88,9 @@ The filter is defined as a JSON that you write over the websocket connections. T "job", "controller", "github_credentials", - "github_endpoint" + "gitea_credentials", + "github_endpoint", + "scaleset" ], "title": "entity type", "description": "The type of entity to filter on", diff --git a/workers/cache/gitea_tools.go b/workers/cache/gitea_tools.go index 43fd86ba..8410a826 100644 --- a/workers/cache/gitea_tools.go +++ b/workers/cache/gitea_tools.go @@ -180,6 +180,10 @@ func getTools(ctx context.Context) ([]commonParams.RunnerApplicationDownload, er slog.InfoContext(ctx, "ignoring unrecognized tools os", "tool", asset.Name) continue } + if !strings.HasSuffix(asset.DownloadURL, ".xz") { + // filter out non compressed versions. + continue + } ret = append(ret, commonParams.RunnerApplicationDownload{ OS: os, Architecture: arch, diff --git a/workers/scaleset/scaleset.go b/workers/scaleset/scaleset.go index f5b34400..03a93387 100644 --- a/workers/scaleset/scaleset.go +++ b/workers/scaleset/scaleset.go @@ -193,6 +193,12 @@ func (w *Worker) Start() (err error) { return fmt.Errorf("updating runner %s: %w", instance.Name, err) } } + } else if instance.Status == commonParams.InstanceDeleted { + if err := w.handleInstanceCleanup(instance); err != nil { + locking.Unlock(instance.Name, false) + return fmt.Errorf("failed to remove database entry for %s: %w", instance.Name, err) + } + continue } w.runners[instance.ID] = instance locking.Unlock(instance.Name, false)