Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyAttempt ¶
ApplyAttempt stores the data from an attempt at applying a single file.
type BatchApplier ¶
type BatchApplier struct {
KubeClient kube.ClientInterface
}
BatchApplier makes apply calls for a batch of files.
func (*BatchApplier) Apply ¶
func (a *BatchApplier) Apply(id int, applyList []string) (successes []ApplyAttempt, failures []ApplyAttempt)
Apply takes a list of files and attempts an apply command on each, labeling logs with the run ID. It returns two lists of ApplyAttempts - one for files that succeeded, and one for files that failed.
type BatchApplierInterface ¶
type BatchApplierInterface interface {
Apply(int, []string) (successes []ApplyAttempt, failures []ApplyAttempt)
}
BatchApplierInterface allows for mocking out the functionality of BatchApplier when testing the full process of an apply run.
type MockBatchApplierInterface ¶
type MockBatchApplierInterface struct {
// contains filtered or unexported fields
}
MockBatchApplierInterface is a mock of BatchApplierInterface interface
func NewMockBatchApplierInterface ¶
func NewMockBatchApplierInterface(ctrl *gomock.Controller) *MockBatchApplierInterface
NewMockBatchApplierInterface creates a new mock instance
func (*MockBatchApplierInterface) Apply ¶
func (_m *MockBatchApplierInterface) Apply(_param0 int, _param1 []string) ([]ApplyAttempt, []ApplyAttempt)
Apply mocks base method
func (*MockBatchApplierInterface) EXPECT ¶
func (_m *MockBatchApplierInterface) EXPECT() *MockBatchApplierInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockBatchApplierInterfaceMockRecorder ¶ added in v0.2.0
type MockBatchApplierInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockBatchApplierInterfaceMockRecorder is the mock recorder for MockBatchApplierInterface
func (*MockBatchApplierInterfaceMockRecorder) Apply ¶ added in v0.2.0
func (_mr *MockBatchApplierInterfaceMockRecorder) Apply(arg0, arg1 interface{}) *gomock.Call
Apply indicates an expected call of Apply
type Result ¶
type Result struct { RunID int RunType RunType Start time.Time Finish time.Time CommitHash string FullCommit string Blacklist []string Whitelist []string Successes []ApplyAttempt Failures []ApplyAttempt DiffURLFormat string }
Result stores the data from a single run of the apply loop. The functions associated with Result convert raw data into the desired formats for insertion into the status page template.
func (*Result) FormattedFinish ¶
FormattedStart returns the Finish time in the format "YYYY-MM-DD hh:mm:ss -0000 GMT"
func (*Result) FormattedRunType ¶ added in v0.2.0
FormattedRunType returns the run type in a string formatted for display.
func (*Result) FormattedStart ¶
FormattedStart returns the Start time in the format "YYYY-MM-DD hh:mm:ss -0000 GMT"
func (*Result) LastCommitLink ¶
LastCommitLink returns a URL for the most recent commit if the envar $DIFF_URL_FORMAT is specified, otherwise it returns empty string.
func (*Result) Latency ¶
Latency returns the latency for the run in seconds, truncated to 3 decimal places.
func (*Result) TotalFiles ¶
TotalFiles returns the total count of apply attempts, both successes and failures.
type Runner ¶
type Runner struct { BatchApplier BatchApplierInterface ListFactory applylist.FactoryInterface GitUtil git.GitUtilInterface Clock sysutil.ClockInterface DiffURLFormat string LastHash string QuickRunQueue <-chan string FullRunQueue <-chan bool RunResults chan<- Result RunMetrics chan<- Result Errors chan<- error RunCount chan int }
Runner manages the full process of an apply run, including getting the appropriate files, running apply commands on them, and handling the results.
func (*Runner) StartFullLoop ¶ added in v0.2.0
func (r *Runner) StartFullLoop()
StartFullLoop runs a continuous loop that starts a new full run through the repo when a request comes into the queue channel.
func (*Runner) StartQuickLoop ¶ added in v0.2.0
func (r *Runner) StartQuickLoop()
StartQuickLoop runs a continuous loop that starts a new quick run (based on a diff) when a request comes into the queue channel.
func (*Runner) StartRunCounter ¶ added in v0.2.0
func (r *Runner) StartRunCounter()
StartRunCounter maintains a run count so that runs can be labeled with an ID.
type Scheduler ¶
type Scheduler struct { GitUtil git.GitUtilInterface PollTicker <-chan time.Time FullRunTicker <-chan time.Time QuickRunQueue chan string FullRunQueue chan<- bool Errors chan<- error LastCommitHash string }
Scheduler handles queueing apply runs at a given time interval and upon every new Git commit.
func (*Scheduler) Start ¶
func (s *Scheduler) Start()
Start runs a continuous loop with two tickers for queueing runs. One ticker queues a new run every X seconds, where X is the value from $FULL_RUN_INTERVAL_SECONDS. The other ticker queues a new run upon every new Git commit, checking the repo every Y seconds where Y is the value from $POLL_INTERVAL_SECONDS.