From f153870f5f7a8d4b18c6dea31eb1986f3833bd22 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Sun, 13 Mar 2022 12:12:01 +0000 Subject: [PATCH] fix: Do not block indefinitely on runner that cannot be deleted due to 403 --- controllers/runner_graceful_stop.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controllers/runner_graceful_stop.go b/controllers/runner_graceful_stop.go index 68e6650e..8f054ad9 100644 --- a/controllers/runner_graceful_stop.go +++ b/controllers/runner_graceful_stop.go @@ -120,6 +120,15 @@ func ensureRunnerUnregistration(ctx context.Context, retryDelay time.Duration, l errRes := &gogithub.ErrorResponse{} if errors.As(err, &errRes) { + if errRes.Response.StatusCode == 403 { + log.Error(err, "Unable to unregister due to permission error. "+ + "Perhaps you've changed the permissions of PAT or GitHub App, or you updated authentication method of ARC in a wrong way? "+ + "ARC considers it as already unregistered and continue removing the pod. "+ + "You may need to remove the runner on GitHub UI.") + + return nil, nil + } + runner, _ := getRunner(ctx, ghClient, enterprise, organization, repository, runner) var runnerID int64