From 5bfecbaa302871cf8b3efaa2ed425038e2f54630 Mon Sep 17 00:00:00 2001 From: Michael Kuhnt Date: Tue, 4 Oct 2022 10:31:23 +0200 Subject: [PATCH] feat: webhook does not return error on 'instance not found'. This case is probably caused by a webhook event that was meant for another runner controller / manager. No need to report this as error, we can simply ignore this and avoid noise in the logs. --- apiserver/controllers/controllers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apiserver/controllers/controllers.go b/apiserver/controllers/controllers.go index 07c8b001..25e429f7 100644 --- a/apiserver/controllers/controllers.go +++ b/apiserver/controllers/controllers.go @@ -102,7 +102,10 @@ func (a *APIController) handleWorkflowJobEvent(w http.ResponseWriter, r *http.Re hookType := r.Header.Get("X-Github-Hook-Installation-Target-Type") if err := a.r.DispatchWorkflowJob(hookType, signature, body); err != nil { - log.Printf("failed to dispatch work: %s", err) + if errors.Is(err, gErrors.ErrNotFound) { + log.Printf("got not found error from DispatchWorkflowJob. webhook not meant for us?: %q", err) + return + } handleError(w, err) return } @@ -183,7 +186,6 @@ func (a *APIController) FirstRunHandler(w http.ResponseWriter, r *http.Request) } w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(newUser) - } func (a *APIController) ListCredentials(w http.ResponseWriter, r *http.Request) {