Add API endpoint for some scaleset ops

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-04-11 10:42:31 +00:00
parent 85eac363d5
commit 7e1a83c79a
31 changed files with 2768 additions and 25 deletions

7
params/interfaces.go Normal file
View file

@ -0,0 +1,7 @@
package params
// EntityGetter is implemented by all github entities (repositories, organizations and enterprises).
// It defines the GetEntity() function which returns a github entity.
type EntityGetter interface {
GetEntity() (GithubEntity, error)
}

View file

@ -153,6 +153,10 @@ type Instance struct {
// instance in the provider.
ProviderID string `json:"provider_id,omitempty"`
// ProviderName is the name of the IaaS where the instance was
// created.
ProviderName string `json:"provider_name"`
// AgentID is the github runner agent ID.
AgentID int64 `json:"agent_id,omitempty"`
@ -212,6 +216,10 @@ type Instance struct {
// Job is the current job that is being serviced by this runner.
Job *Job `json:"job,omitempty"`
// RunnerBootstrapTimeout is the timeout in minutes after which the runner deployment
// will be considered failed. This value is caried over from the pool or scale set.
RunnerBootstrapTimeout uint `json:"runner_bootstrap_timeout,omitempty"`
// Do not serialize sensitive info.
CallbackURL string `json:"-"`
MetadataURL string `json:"-"`
@ -229,6 +237,13 @@ func (i Instance) GetID() string {
return i.ID
}
func (i Instance) RunnerTimeout() uint {
if i.RunnerBootstrapTimeout == 0 {
return appdefaults.DefaultRunnerBootstrapTimeout
}
return i.RunnerBootstrapTimeout
}
// used by swagger client generated code
type Instances []Instance