Add runner periodic cleanup check
Adds a periodic cleanup function that cross checks runners between github, the provider and the GARM database. If an inconsistency is found, GARM will attempt to fix it. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
73340da322
commit
059734f064
12 changed files with 479 additions and 43 deletions
|
|
@ -421,6 +421,7 @@ func (r RunnerScaleSetMessage) GetJobsFromBody() ([]ScaleSetJobMessage, error) {
|
|||
type RunnerReference struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
OS string `json:"os"`
|
||||
RunnerScaleSetID int `json:"runnerScaleSetId"`
|
||||
CreatedOn interface{} `json:"createdOn"`
|
||||
RunnerGroupID uint64 `json:"runnerGroupId"`
|
||||
|
|
@ -431,9 +432,29 @@ type RunnerReference struct {
|
|||
Status interface{} `json:"status"`
|
||||
DisableUpdate bool `json:"disableUpdate"`
|
||||
ProvisioningState string `json:"provisioningState"`
|
||||
Busy bool `json:"busy"`
|
||||
Labels []Label `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
func (r RunnerReference) GetStatus() RunnerStatus {
|
||||
status, ok := r.Status.(string)
|
||||
if !ok {
|
||||
return RunnerUnknown
|
||||
}
|
||||
runnerStatus := RunnerStatus(status)
|
||||
if !runnerStatus.IsValid() {
|
||||
return RunnerUnknown
|
||||
}
|
||||
|
||||
if runnerStatus == RunnerOnline {
|
||||
if r.Busy {
|
||||
return RunnerActive
|
||||
}
|
||||
return RunnerIdle
|
||||
}
|
||||
return runnerStatus
|
||||
}
|
||||
|
||||
type RunnerScaleSetJitRunnerConfig struct {
|
||||
Runner *RunnerReference `json:"runner"`
|
||||
EncodedJITConfig string `json:"encodedJITConfig"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue