Documentation
¶
Index ¶
- type GitHubClient
- type JobDetail
- type Reconciler
- type Scheduler
- func (s *Scheduler) AddJob(annotation github.CronAnnotation) error
- func (s *Scheduler) GetJobDetails() []JobDetail
- func (s *Scheduler) GetLastReconcileTime() time.Time
- func (s *Scheduler) GetRegisteredJobCount() int
- func (s *Scheduler) GetRegisteredKeys() []github.CronJobKey
- func (s *Scheduler) GetSkippedAnnotations() []scanner.SkippedAnnotation
- func (s *Scheduler) RemoveJob(key github.CronJobKey)
- func (s *Scheduler) RunReconcileLoop(ctx context.Context, interval time.Duration)
- func (s *Scheduler) SetSkippedAnnotations(skipped []scanner.SkippedAnnotation)
- func (s *Scheduler) Stop()
- type StateClient
- type StateManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubClient ¶
type GitHubClient interface {
DispatchWorkflow(ctx context.Context, owner, repo, workflowFile, ref string) error
GetVariable(ctx context.Context, owner, repo, name string) (string, error)
SetVariable(ctx context.Context, owner, repo, name, value string) error
GetInstallationRepos(ctx context.Context) ([]github.Repository, error)
GetWorkflowFiles(ctx context.Context, owner, repo string) ([]github.WorkflowFile, error)
GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
}
GitHubClient is the GitHub API interface used by the scheduler.
type JobDetail ¶
type JobDetail struct {
Owner string `json:"owner"`
Repo string `json:"repo"`
WorkflowFile string `json:"workflow_file"`
CronExpr string `json:"cron_expr"`
NextRun time.Time `json:"next_run"`
}
JobDetail holds detailed information about a registered job.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler applies diffs between desired state and actual state.
func NewReconciler ¶
func NewReconciler(client GitHubClient, sched *Scheduler, cfg *config.ReconcileConfig) *Reconciler
NewReconciler creates a new Reconciler.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages cron jobs.
func New ¶
func New(client GitHubClient, cfg *config.ReconcileConfig, loc *time.Location) *Scheduler
New creates a new Scheduler.
func (*Scheduler) AddJob ¶
func (s *Scheduler) AddJob(annotation github.CronAnnotation) error
AddJob registers a cron job.
func (*Scheduler) GetJobDetails ¶
GetJobDetails returns details of all registered jobs (StatusProvider).
func (*Scheduler) GetLastReconcileTime ¶
GetLastReconcileTime returns the last reconcile timestamp (StatusProvider).
func (*Scheduler) GetRegisteredJobCount ¶
GetRegisteredJobCount returns the number of registered jobs (StatusProvider).
func (*Scheduler) GetRegisteredKeys ¶
func (s *Scheduler) GetRegisteredKeys() []github.CronJobKey
GetRegisteredKeys returns all registered job keys.
func (*Scheduler) GetSkippedAnnotations ¶ added in v0.2.0
func (s *Scheduler) GetSkippedAnnotations() []scanner.SkippedAnnotation
GetSkippedAnnotations returns annotations that failed validation (StatusProvider).
func (*Scheduler) RemoveJob ¶
func (s *Scheduler) RemoveJob(key github.CronJobKey)
RemoveJob removes a cron job.
func (*Scheduler) RunReconcileLoop ¶
RunReconcileLoop runs the reconciliation loop.
func (*Scheduler) SetSkippedAnnotations ¶ added in v0.2.0
func (s *Scheduler) SetSkippedAnnotations(skipped []scanner.SkippedAnnotation)
SetSkippedAnnotations updates the skipped annotations from the last scan.
type StateClient ¶
type StateClient interface {
GetVariable(ctx context.Context, owner, repo, name string) (string, error)
SetVariable(ctx context.Context, owner, repo, name, value string) error
}
StateClient is the interface used by StateManager.
type StateManager ¶
type StateManager struct {
// contains filtered or unexported fields
}
StateManager manages state via GitHub Actions Variables.
func NewStateManager ¶
func NewStateManager(client StateClient) *StateManager
NewStateManager creates a new StateManager.
func (*StateManager) GetLastDispatchTime ¶
func (sm *StateManager) GetLastDispatchTime(ctx context.Context, annotation github.CronAnnotation) (time.Time, error)
GetLastDispatchTime retrieves the last dispatch time.
func (*StateManager) SetLastDispatchTime ¶
func (sm *StateManager) SetLastDispatchTime(ctx context.Context, annotation github.CronAnnotation, t time.Time) error
SetLastDispatchTime persists the dispatch time.