Skip to content

Commit

Permalink
feat: webhook does not return error on 'instance not found'.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
maigl committed Oct 6, 2022
1 parent e0d1de6 commit ac27c73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apiserver/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"io/ioutil"
"log"
"net/http"
"strings"

"garm/apiserver/params"
"garm/auth"
Expand Down Expand Up @@ -103,6 +104,11 @@ func (a *APIController) handleWorkflowJobEvent(w http.ResponseWriter, r *http.Re

if err := a.r.DispatchWorkflowJob(hookType, signature, body); err != nil {
log.Printf("failed to dispatch work: %s", err)
// in this case we probably got a webhook that was not meant for us
// no need to return an error
if strings.Contains(err.Error(), "fetching instance by name: not found") {
return
}
handleError(w, err)
return
}
Expand Down Expand Up @@ -183,7 +189,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) {
Expand Down

0 comments on commit ac27c73

Please sign in to comment.