mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 12:06:57 +00:00
Compare commits
2 Commits
actions-ru
...
v0.21.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9aea0bd9c | ||
|
|
fcf4778bac |
@@ -614,11 +614,7 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) getManagedRunnerGroup
|
|||||||
return nil, fmt.Errorf("unsupported scale target kind: %v", kind)
|
return nil, fmt.Errorf("unsupported scale target kind: %v", kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
if g == "" {
|
if g != "" && e == "" && o == "" {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if e == "" && o == "" {
|
|
||||||
autoscaler.Log.V(1).Info(
|
autoscaler.Log.V(1).Info(
|
||||||
"invalid runner group config in scale target: spec.group must be set along with either spec.enterprise or spec.organization",
|
"invalid runner group config in scale target: spec.group must be set along with either spec.enterprise or spec.organization",
|
||||||
"scaleTargetKind", kind,
|
"scaleTargetKind", kind,
|
||||||
@@ -631,6 +627,16 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) getManagedRunnerGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
if e != enterprise && o != org {
|
if e != enterprise && o != org {
|
||||||
|
autoscaler.Log.V(1).Info(
|
||||||
|
"Skipped scale target irrelevant to event",
|
||||||
|
"eventOrganization", org,
|
||||||
|
"eventEnterprise", enterprise,
|
||||||
|
"scaleTargetKind", kind,
|
||||||
|
"scaleTargetGroup", g,
|
||||||
|
"scaleTargetEnterprise", e,
|
||||||
|
"scaleTargetOrganization", o,
|
||||||
|
)
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package simulator
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-github/v39/github"
|
"github.com/google/go-github/v39/github"
|
||||||
)
|
)
|
||||||
@@ -96,6 +97,10 @@ type RunnerGroup struct {
|
|||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r RunnerGroup) String() string {
|
||||||
|
return fmt.Sprintf("RunnerGroup{Scope:%s, Kind:%s, Name:%s}", r.Scope, r.Kind, r.Name)
|
||||||
|
}
|
||||||
|
|
||||||
// VisibleRunnerGroups is a set of enterprise and organization runner groups
|
// VisibleRunnerGroups is a set of enterprise and organization runner groups
|
||||||
// that are visible to a GitHub repository.
|
// that are visible to a GitHub repository.
|
||||||
// GitHub Actions chooses one of such visible group on which the workflow job is scheduled.
|
// GitHub Actions chooses one of such visible group on which the workflow job is scheduled.
|
||||||
@@ -111,6 +116,15 @@ func NewVisibleRunnerGroups() *VisibleRunnerGroups {
|
|||||||
return &VisibleRunnerGroups{}
|
return &VisibleRunnerGroups{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *VisibleRunnerGroups) String() string {
|
||||||
|
var gs []string
|
||||||
|
for _, g := range g.sortedGroups {
|
||||||
|
gs = append(gs, g.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(gs, ", ")
|
||||||
|
}
|
||||||
|
|
||||||
func (g *VisibleRunnerGroups) IsEmpty() bool {
|
func (g *VisibleRunnerGroups) IsEmpty() bool {
|
||||||
return len(g.sortedGroups) == 0
|
return len(g.sortedGroups) == 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user