Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoToken informs the user that at least one token is required. ErrNoToken = errors.New("no githubToken or gitlabToken or forgejoToken or bitbucketToken configured - https://saturn-bot.readthedocs.io/en/latest/configuration/") )
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
// An API token to authenticate at the Bitbucket API. See
// https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication.
BitbucketToken string `json:"bitbucketToken,omitempty" yaml:"bitbucketToken,omitempty" mapstructure:"bitbucketToken,omitempty"`
// The username associated with a Bitbucket API token. This is the e-mail address
// of the Atlassian account that owns the API token. See
// https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/.
BitbucketUsername string `json:"bitbucketUsername,omitempty" yaml:"bitbucketUsername,omitempty" mapstructure:"bitbucketUsername,omitempty"`
// The workspace to query in Bitbucket.
BitbucketWorkspace string `json:"bitbucketWorkspace,omitempty" yaml:"bitbucketWorkspace,omitempty" mapstructure:"bitbucketWorkspace,omitempty"`
// Path to directory to store files and repository clones.
DataDir *string `json:"dataDir,omitempty" yaml:"dataDir,omitempty" mapstructure:"dataDir,omitempty"`
// Toggle dry-run mode. No pull requests will be created or merged when enabled.
DryRun bool `json:"dryRun,omitempty" yaml:"dryRun,omitempty" mapstructure:"dryRun,omitempty"`
// Address of the Forgejo instance. For example, `http://forgejo.local/api/v1`.
ForgejoAddress string `json:"forgejoAddress,omitempty" yaml:"forgejoAddress,omitempty" mapstructure:"forgejoAddress,omitempty"`
// Token to authenticate at the the Forgejo instance.
ForgejoToken string `json:"forgejoToken,omitempty" yaml:"forgejoToken,omitempty" mapstructure:"forgejoToken,omitempty"`
// Author to use for git commits. Global git configuration applies if not set.
// Must conform to RFC5322: `User Name <[email protected]>`.
GitAuthor string `json:"gitAuthor,omitempty" yaml:"gitAuthor,omitempty" mapstructure:"gitAuthor,omitempty"`
// Command-line options to pass to `git clone`.
GitCloneOptions []string `json:"gitCloneOptions,omitempty" yaml:"gitCloneOptions,omitempty" mapstructure:"gitCloneOptions,omitempty"`
// Level for logs sent by the git sub-system. These logs can be very verbose and
// can make it tricky to find logs of other sub-systems.
GitLogLevel ConfigurationGitLogLevel `json:"gitLogLevel,omitempty" yaml:"gitLogLevel,omitempty" mapstructure:"gitLogLevel,omitempty"`
// Path to `git` executable. PATH will be searched if not set.
GitPath string `json:"gitPath,omitempty" yaml:"gitPath,omitempty" mapstructure:"gitPath,omitempty"`
// PGP key to sign Git commits.
GitPrivateKey string `json:"gitPrivateKey,omitempty" yaml:"gitPrivateKey,omitempty" mapstructure:"gitPrivateKey,omitempty"`
// Configure how to clone git repositories.
GitUrl ConfigurationGitUrl `json:"gitUrl,omitempty" yaml:"gitUrl,omitempty" mapstructure:"gitUrl,omitempty"`
// Address of GitHub server to use.
GithubAddress *string `json:"githubAddress,omitempty" yaml:"githubAddress,omitempty" mapstructure:"githubAddress,omitempty"`
// If true, disables caching of HTTP responses received from the GitHub API.
GithubCacheDisabled bool `json:"githubCacheDisabled,omitempty" yaml:"githubCacheDisabled,omitempty" mapstructure:"githubCacheDisabled,omitempty"`
// Token to use for authentication at the GitHub API.
GithubToken *string `json:"githubToken,omitempty" yaml:"githubToken,omitempty" mapstructure:"githubToken,omitempty"`
// Address of GitLab server to use.
GitlabAddress string `json:"gitlabAddress,omitempty" yaml:"gitlabAddress,omitempty" mapstructure:"gitlabAddress,omitempty"`
// Token to use for authentication at the GitLab API.
GitlabToken *string `json:"gitlabToken,omitempty" yaml:"gitlabToken,omitempty" mapstructure:"gitlabToken,omitempty"`
// Activate Go profiling endpoints for server or worker. The endpoints are
// available at /debug/pprof/. See https://go.dev/blog/pprof.
GoProfiling bool `json:"goProfiling,omitempty" yaml:"goProfiling,omitempty" mapstructure:"goProfiling,omitempty"`
// List of labels to add to each pull request created by Saturn. Allows an
// operator of Saturn to ensure that specific labels are always added without
// relying on the authors of tasks to set them.
Labels []string `json:"labels,omitempty" yaml:"labels,omitempty" mapstructure:"labels,omitempty"`
// Format of log messages.
LogFormat ConfigurationLogFormat `json:"logFormat,omitempty" yaml:"logFormat,omitempty" mapstructure:"logFormat,omitempty"`
// Log level of the application.
LogLevel ConfigurationLogLevel `json:"logLevel,omitempty" yaml:"logLevel,omitempty" mapstructure:"logLevel,omitempty"`
// Address of a Prometheus Pushgateway to send metrics to.
PrometheusPushgatewayUrl *string `` /* 133-byte string literal not displayed */
// Time-to-live of all items in the repository file cache. Saturn performs a full
// update of the cache once the TTL has expired. The format is a Go duration, like
// `30m` or `12h`.
RepositoryCacheTtl string `json:"repositoryCacheTtl,omitempty" yaml:"repositoryCacheTtl,omitempty" mapstructure:"repositoryCacheTtl,omitempty"`
// Turn HTTP access log of server on or off.
ServerAccessLog bool `json:"serverAccessLog,omitempty" yaml:"serverAccessLog,omitempty" mapstructure:"serverAccessLog,omitempty"`
// Address of the server in the format `<host>:<port>`.
ServerAddr string `json:"serverAddr,omitempty" yaml:"serverAddr,omitempty" mapstructure:"serverAddr,omitempty"`
// Secret required to authenticate at the API. Clients set the key as the value of
// the HTTP header X-API-KEY. Required if Saturn runs in server mode.
ServerApiKey string `json:"serverApiKey,omitempty" yaml:"serverApiKey,omitempty" mapstructure:"serverApiKey,omitempty"`
// URL of the API server. The value is used to populate the `servers` array in the
// OpenAPI definition.
ServerBaseUrl string `json:"serverBaseUrl,omitempty" yaml:"serverBaseUrl,omitempty" mapstructure:"serverBaseUrl,omitempty"`
// Turn compression of responses on or off.
ServerCompress bool `json:"serverCompress,omitempty" yaml:"serverCompress,omitempty" mapstructure:"serverCompress,omitempty"`
// If `true`, display executed SQL queries and errors of the database. Useful for
// debugging.
ServerDatabaseLog bool `json:"serverDatabaseLog,omitempty" yaml:"serverDatabaseLog,omitempty" mapstructure:"serverDatabaseLog,omitempty"`
// Path to the sqlite database of the server. If unset, defaults to
// `<dataDir>/db/Saturn.db`.
ServerDatabasePath string `json:"serverDatabasePath,omitempty" yaml:"serverDatabasePath,omitempty" mapstructure:"serverDatabasePath,omitempty"`
// Time out a run if a worker takes longer than the given duration to report it.
ServerRunTimeout string `json:"serverRunTimeout,omitempty" yaml:"serverRunTimeout,omitempty" mapstructure:"serverRunTimeout,omitempty"`
// Interval at which the server checks if it needs to time out runs.
ServerRunTimeoutCheckInterval string `` /* 148-byte string literal not displayed */
// If `true`, serves the user interface.
ServerServeUi bool `json:"serverServeUi,omitempty" yaml:"serverServeUi,omitempty" mapstructure:"serverServeUi,omitempty"`
// Secret to authenticate webhook requests sent by GitHub.
ServerWebhookSecretGithub string `` /* 136-byte string literal not displayed */
// Secret to authenticate webhook requests sent by GitLab. See
// https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#create-a-webhook
// for how to set up the token.
ServerWebhookSecretGitlab string `` /* 136-byte string literal not displayed */
// The default shell to use to execute scripts.
Shell string `json:"shell,omitempty" yaml:"shell,omitempty" mapstructure:"shell,omitempty"`
// Interval at which a worker queries the server to receive new tasks to execute.
WorkerLoopInterval string `json:"workerLoopInterval,omitempty" yaml:"workerLoopInterval,omitempty" mapstructure:"workerLoopInterval,omitempty"`
// Number of parallel executions of tasks per worker.
WorkerParallelExecutions int `` /* 133-byte string literal not displayed */
// Base URL of the server API to query for new tasks to execute.
WorkerServerAPIBaseURL string `` /* 127-byte string literal not displayed */
}
Configuration settings of Saturn.
func Read ¶
func Read(cfgFile string) (cfg Configuration, err error)
func (Configuration) GitUserEmail ¶
func (c Configuration) GitUserEmail() string
func (Configuration) GitUserName ¶
func (c Configuration) GitUserName() string
func (*Configuration) UnmarshalJSON ¶
func (j *Configuration) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*Configuration) UnmarshalYAML ¶
func (j *Configuration) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.
type ConfigurationGitLogLevel ¶
type ConfigurationGitLogLevel string
const ConfigurationGitLogLevelDebug ConfigurationGitLogLevel = "debug"
const ConfigurationGitLogLevelError ConfigurationGitLogLevel = "error"
const ConfigurationGitLogLevelInfo ConfigurationGitLogLevel = "info"
const ConfigurationGitLogLevelWarn ConfigurationGitLogLevel = "warn"
func (*ConfigurationGitLogLevel) UnmarshalJSON ¶
func (j *ConfigurationGitLogLevel) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*ConfigurationGitLogLevel) UnmarshalYAML ¶
func (j *ConfigurationGitLogLevel) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.
type ConfigurationGitUrl ¶
type ConfigurationGitUrl string
const ConfigurationGitUrlHttps ConfigurationGitUrl = "https"
const ConfigurationGitUrlSsh ConfigurationGitUrl = "ssh"
func (*ConfigurationGitUrl) UnmarshalJSON ¶
func (j *ConfigurationGitUrl) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*ConfigurationGitUrl) UnmarshalYAML ¶
func (j *ConfigurationGitUrl) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.
type ConfigurationLogFormat ¶
type ConfigurationLogFormat string
const ConfigurationLogFormatAuto ConfigurationLogFormat = "auto"
const ConfigurationLogFormatConsole ConfigurationLogFormat = "console"
const ConfigurationLogFormatJson ConfigurationLogFormat = "json"
func (*ConfigurationLogFormat) UnmarshalJSON ¶
func (j *ConfigurationLogFormat) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*ConfigurationLogFormat) UnmarshalYAML ¶
func (j *ConfigurationLogFormat) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.
type ConfigurationLogLevel ¶
type ConfigurationLogLevel string
const ConfigurationLogLevelDebug ConfigurationLogLevel = "debug"
const ConfigurationLogLevelError ConfigurationLogLevel = "error"
const ConfigurationLogLevelInfo ConfigurationLogLevel = "info"
const ConfigurationLogLevelWarn ConfigurationLogLevel = "warn"
func (*ConfigurationLogLevel) UnmarshalJSON ¶
func (j *ConfigurationLogLevel) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*ConfigurationLogLevel) UnmarshalYAML ¶
func (j *ConfigurationLogLevel) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.
Click to show internal directories.
Click to hide internal directories.