Documentation
¶
Overview ¶
Package cigate holds a deploy until the CI checks on a commit conclude.
Index ¶
Constants ¶
View Source
const ( EnvTimeout = "APP_CI_GATE_TIMEOUT" EnvPollInterval = "APP_CI_GATE_POLL_INTERVAL" EnvNoChecksWait = "APP_CI_GATE_NO_CHECKS_WAIT" )
Environment variables that tune the gate.
View Source
const ( DefaultTimeout = 15 * time.Minute DefaultPollInterval = 15 * time.Second DefaultNoChecksWait = time.Minute )
Defaults used when the environment leaves a value unset or invalid.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Timeout time.Duration
PollInterval time.Duration
NoChecksWait time.Duration
Sleep func(ctx context.Context, d time.Duration) error
Now func() time.Time
}
Config tunes polling. Sleep is replaceable so tests need no real time.
func ConfigFromEnv ¶
func ConfigFromEnv() Config
ConfigFromEnv reads the gate settings, falling back to the defaults.
type GitHub ¶
type GitHub struct {
HTTP *http.Client
BaseURL string
Token string
Owner string
Repo string
Now func() time.Time
}
GitHub reads check runs and commit statuses from the GitHub REST API.
type Policy ¶
type Policy struct {
// Required names the checks that must pass; empty means every check seen.
Required []string
// IgnorePrefixes drops checks the platform posts itself, which would deadlock the gate.
IgnorePrefixes []string
}
Policy picks which checks the gate waits for.
type RateLimitError ¶
RateLimitError tells the gate to wait before the next read.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
Click to show internal directories.
Click to hide internal directories.