From ced88228fc6b8a0f83d1c03d0effc79ef55ad7d5 Mon Sep 17 00:00:00 2001 From: Nathan Klick Date: Mon, 20 Feb 2023 19:56:46 -0600 Subject: [PATCH] Resolves the erroneous webhook scale down due to check runs (#2119) Signed-off-by: Nathan Klick --- .../horizontal_runner_autoscaler_webhook.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go b/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go index 96be3987..59f70469 100644 --- a/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go +++ b/controllers/actions.summerwind.net/horizontal_runner_autoscaler_webhook.go @@ -210,9 +210,9 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons if e.GetAction() == "queued" { target.Amount = 1 break - } else if e.GetAction() == "completed" && e.GetWorkflowJob().GetConclusion() != "skipped" { - // A nagative amount is processed in the tryScale func as a scale-down request, - // that erasese the oldest CapacityReservation with the same amount. + } else if e.GetAction() == "completed" && e.GetWorkflowJob().GetConclusion() != "skipped" && e.GetWorkflowJob().GetRunnerID() > 0 { + // A negative amount is processed in the tryScale func as a scale-down request, + // that erases the oldest CapacityReservation with the same amount. // If the first CapacityReservation was with Replicas=1, this negative scale target erases that, // so that the resulting desired replicas decreases by 1. target.Amount = -1