Ensure ephemeral runner is deleted on exit != 0

This commit is contained in:
Nikola Jokic 2025-09-25 08:59:24 +02:00
parent 088e2a3a90
commit 5488aeb247
No known key found for this signature in database
GPG Key ID: E4104494F9B8DDF6
1 changed files with 11 additions and 0 deletions

View File

@ -336,6 +336,17 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
log.Error(err, "Failed to delete the ephemeral runner that has a job assigned but the pod has failed")
return ctrl.Result{}, err
}
actionsClient, err := r.GetActionsService(ctx, ephemeralRunner)
if err != nil {
log.Error(err, "Failed to get actions client for checking the job status")
return ctrl.Result{}, nil
}
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId)); err != nil {
log.Error(err, "Failed to remove the runner from the service")
return ctrl.Result{}, nil
}
return ctrl.Result{}, nil
}
if err := r.deletePodAsFailed(ctx, ephemeralRunner, pod, log); err != nil {