Make webhook-based autoscaler github event logs more operator-friendly (#384)
Adds fields like `pullRequest.base.ref` and `checkRun.status` that are useful for verifying the autoscaling behaviour without browsing GitHub. Ref https://github.com/summerwind/actions-runner-controller/issues/377#issuecomment-794175312
This commit is contained in:
parent
81016154c0
commit
f5c639ae28
|
|
@ -159,6 +159,13 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons
|
||||||
e.Repo.Owner.GetType(),
|
e.Repo.Owner.GetType(),
|
||||||
autoscaler.MatchPullRequestEvent(e),
|
autoscaler.MatchPullRequestEvent(e),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if pullRequest := e.PullRequest; pullRequest != nil {
|
||||||
|
log = log.WithValues(
|
||||||
|
"pullRequest.base.ref", e.PullRequest.Base.GetRef(),
|
||||||
|
"action", e.GetAction(),
|
||||||
|
)
|
||||||
|
}
|
||||||
case *gogithub.CheckRunEvent:
|
case *gogithub.CheckRunEvent:
|
||||||
target, err = autoscaler.getScaleUpTarget(
|
target, err = autoscaler.getScaleUpTarget(
|
||||||
context.TODO(),
|
context.TODO(),
|
||||||
|
|
@ -168,6 +175,13 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons
|
||||||
e.Repo.Owner.GetType(),
|
e.Repo.Owner.GetType(),
|
||||||
autoscaler.MatchCheckRunEvent(e),
|
autoscaler.MatchCheckRunEvent(e),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if checkRun := e.GetCheckRun(); checkRun != nil {
|
||||||
|
log = log.WithValues(
|
||||||
|
"checkRun.status", checkRun.GetStatus(),
|
||||||
|
"action", e.GetAction(),
|
||||||
|
)
|
||||||
|
}
|
||||||
case *gogithub.PingEvent:
|
case *gogithub.PingEvent:
|
||||||
ok = true
|
ok = true
|
||||||
|
|
||||||
|
|
@ -195,9 +209,11 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons
|
||||||
}
|
}
|
||||||
|
|
||||||
if target == nil {
|
if target == nil {
|
||||||
msg := "no horizontalrunnerautoscaler to scale for this github event"
|
log.Info(
|
||||||
|
"Scale target not found. If this is unexpected, ensure that there is exactly one repository-wide or organizational runner deployment that matches this webhook event",
|
||||||
|
)
|
||||||
|
|
||||||
log.Info(msg, "eventType", webhookType)
|
msg := "no horizontalrunnerautoscaler to scale for this github event"
|
||||||
|
|
||||||
ok = true
|
ok = true
|
||||||
|
|
||||||
|
|
@ -365,10 +381,6 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) getScaleUpTarget(ctx
|
||||||
return target, nil
|
return target, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info(
|
|
||||||
"Scale target not found. If this is unexpected, ensure that there is exactly one repository-wide or organizational runner deployment that matches this webhook event",
|
|
||||||
)
|
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue