2022-07-07 16:48:00 +00:00
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
2023-12-18 16:09:49 +00:00
|
|
|
"github.com/google/go-github/v57/github"
|
2024-03-17 11:07:44 +00:00
|
|
|
|
|
|
|
|
"github.com/cloudbase/garm/params"
|
2022-07-07 16:48:00 +00:00
|
|
|
)
|
|
|
|
|
|
2024-03-17 10:21:41 +00:00
|
|
|
type GithubEntityOperations interface {
|
|
|
|
|
ListEntityHooks(ctx context.Context, opts *github.ListOptions) (ret []*github.Hook, response *github.Response, err error)
|
|
|
|
|
GetEntityHook(ctx context.Context, id int64) (ret *github.Hook, err error)
|
|
|
|
|
CreateEntityHook(ctx context.Context, hook *github.Hook) (ret *github.Hook, err error)
|
|
|
|
|
DeleteEntityHook(ctx context.Context, id int64) (ret *github.Response, err error)
|
|
|
|
|
PingEntityHook(ctx context.Context, id int64) (ret *github.Response, err error)
|
|
|
|
|
ListEntityRunners(ctx context.Context, opts *github.ListOptions) (*github.Runners, *github.Response, error)
|
|
|
|
|
ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error)
|
|
|
|
|
RemoveEntityRunner(ctx context.Context, runnerID int64) (*github.Response, error)
|
|
|
|
|
CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error)
|
|
|
|
|
GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (jitConfigMap map[string]string, runner *github.Runner, err error)
|
2023-08-15 17:19:06 +00:00
|
|
|
}
|
|
|
|
|
|
2022-07-07 16:48:00 +00:00
|
|
|
// GithubClient that describes the minimum list of functions we need to interact with github.
|
|
|
|
|
// Allows for easier testing.
|
2022-10-13 16:09:28 +00:00
|
|
|
//
|
|
|
|
|
//go:generate mockery --all
|
2022-07-07 16:48:00 +00:00
|
|
|
type GithubClient interface {
|
2024-03-17 10:21:41 +00:00
|
|
|
GithubEntityOperations
|
2023-08-15 17:19:06 +00:00
|
|
|
|
2022-09-20 14:25:52 +03:00
|
|
|
// GetWorkflowJobByID gets details about a single workflow job.
|
|
|
|
|
GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*github.WorkflowJob, *github.Response, error)
|
2022-10-13 16:09:28 +00:00
|
|
|
}
|