From c37f1aeef17420175db49e03e14e2f7582398462 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Thu, 19 Mar 2026 11:51:54 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../v1alpha1/autoscalingrunnerset_types.go | 2 -- .../actions.github.com/ephemeralrunner_controller.go | 2 ++ .../actions.github.com/ephemeralrunnerset_controller.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go b/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go index 23ff3d5b..8cff49c8 100644 --- a/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go +++ b/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go @@ -341,13 +341,11 @@ func (ars *AutoscalingRunnerSet) Hash() string { type data struct { Spec *AutoscalingRunnerSetSpec Labels map[string]string - Phase AutoscalingRunnerSetPhase } d := &data{ Spec: ars.Spec.DeepCopy(), Labels: ars.Labels, - Phase: ars.Status.Phase, } return hash.ComputeTemplateHash(d) diff --git a/controllers/actions.github.com/ephemeralrunner_controller.go b/controllers/actions.github.com/ephemeralrunner_controller.go index bec0eb7e..616c0e04 100644 --- a/controllers/actions.github.com/ephemeralrunner_controller.go +++ b/controllers/actions.github.com/ephemeralrunner_controller.go @@ -339,6 +339,7 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ case 7: if err := r.markAsOutdated(ctx, ephemeralRunner, log); err != nil { log.Error(err, "Failed to set ephemeral runner to phase Outdated") + return ctrl.Result{}, err } return ctrl.Result{}, nil } @@ -366,6 +367,7 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ case cs.State.Terminated.ExitCode == 7: // outdated if err := r.markAsOutdated(ctx, ephemeralRunner, log); err != nil { log.Error(err, "Failed to set ephemeral runner to phase Outdated") + return ctrl.Result{}, err } return ctrl.Result{}, nil diff --git a/controllers/actions.github.com/ephemeralrunnerset_controller.go b/controllers/actions.github.com/ephemeralrunnerset_controller.go index 48f03bf1..7f81216d 100644 --- a/controllers/actions.github.com/ephemeralrunnerset_controller.go +++ b/controllers/actions.github.com/ephemeralrunnerset_controller.go @@ -163,7 +163,7 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R ephemeralRunnersByState := newEphemeralRunnersByStates(ephemeralRunnerList) log.Info("Ephemeral runner counts", - "outdated", ephemeralRunnersByState.outdated, + "outdated", len(ephemeralRunnersByState.outdated), "pending", len(ephemeralRunnersByState.pending), "running", len(ephemeralRunnersByState.running), "finished", len(ephemeralRunnersByState.finished), @@ -240,10 +240,10 @@ func (r *EphemeralRunnerSetReconciler) updateStatus(ctx context.Context, ephemer total := state.scaleTotal() var phase v1alpha1.EphemeralRunnerSetPhase switch { - case ephemeralRunnerSet.Status.Phase == "": - phase = v1alpha1.EphemeralRunnerSetPhaseRunning case len(state.outdated) > 0: phase = v1alpha1.EphemeralRunnerSetPhaseOutdated + case ephemeralRunnerSet.Status.Phase == "": + phase = v1alpha1.EphemeralRunnerSetPhaseRunning default: phase = ephemeralRunnerSet.Status.Phase }