Documentation ¶
Index ¶
- Variables
- func Dump(cfg Config) string
- type Aws
- type AwsCfDistribution
- type Bitbucket
- type Command
- type Config
- type Cron
- type Github
- type Jenkins
- type JenkinsJobs
- type Jira
- type JiraField
- type JobConfig
- type JobParameter
- type Logger
- type Metrics
- type Notifications
- type OpenWeather
- type Pool
- type PullRequest
- type PullRequestReactions
- type Resource
- type Slack
- type UserList
- type UserMap
- type VCS
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{ StoragePath: "./storage/", Logger: Logger{ File: "./bot.log", Level: "info", }, OpenWeather: OpenWeather{ Units: "metric", }, Jira: Jira{ Fields: []JiraField{ { Name: "type", Icons: map[string]string{ "Bug": ":bug:", }, }, }, }, PullRequest: PullRequest{ Notifications: Notifications{ BuildStatusInProgress: false, BuildStatusSuccess: false, BuildStatusFailed: false, PullRequestStatusMergeable: false, }, Reactions: PullRequestReactions{ InReview: "eyes", Approved: "white_check_mark", Merged: "twisted_rightwards_arrows", Closed: "x", BuildSuccess: "white_check_mark", BuildFailed: "fire", BuildRunning: "arrows_counterclockwise", Error: "x", }, }, BranchLookup: VCS{ UpdateInterval: time.Minute * 2, }, }
DefaultConfig with some common values
Functions ¶
Types ¶
type Aws ¶ added in v2.2.6
type Aws struct { Enabled bool `mapstructure:"enabled"` CloudFront []AwsCfDistribution `mapstructure:"cloud_front"` }
type AwsCfDistribution ¶ added in v2.2.6
type Bitbucket ¶
type Bitbucket struct { Host string `mapstructure:"host"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` APIKey string `mapstructure:"api_key"` Project string `mapstructure:"project"` Repository string `mapstructure:"repository"` }
Bitbucket credentials/options. Either add Username+Password OR a APIKey
type Command ¶
type Command struct { Name string Description string Trigger string Category string Commands []string Examples []string }
Command represents a single macro which is defined by a trigger regexp and a list of executed commands
type Config ¶
type Config struct { Slack Slack `mapstructure:"slack"` // authentication/authorization NoAuthentication bool `mapstructure:"no_authentication"` AllowedUsers UserList `mapstructure:"allowed_users,flow"` AdminUsers UserList `mapstructure:"admin_users,flow"` Pool Pool `mapstructure:"pool"` Jenkins Jenkins `mapstructure:"jenkins"` Jira Jira `mapstructure:"jira"` StoragePath string `mapstructure:"storage_path"` Bitbucket Bitbucket `mapstructure:"bitbucket"` Github Github `mapstructure:"github"` Gitlab struct { AccessToken string Host string } `mapstructure:"gitlab"` Aws Aws `mapstructure:"aws"` Commands []Command `mapstructure:"commands"` Crons []Cron `mapstructure:"crons"` Logger Logger `mapstructure:"logger"` BranchLookup VCS `mapstructure:"branch_lookup"` // Metrics, like Prometheus Metrics Metrics `mapstructure:"metrics"` OpenWeather OpenWeather `mapstructure:"open_weather"` PullRequest PullRequest `mapstructure:"pullrequest"` Timezone string `mapstructure:"timezone"` // list of slack-bot plugins to load Plugins []string `mapstructure:"plugins"` // contains filtered or unexported fields }
Config contains the full config structure of this bot
func (*Config) LoadCustom ¶ added in v2.2.10
LoadCustom does a dynamic config lookup with a given key and unmarshal it into the value
type Cron ¶
type Cron struct { Channel string `mapstructure:"channel"` Schedule string `mapstructure:"schedule"` Commands []string `mapstructure:"commands"` }
Cron is represents a single cron which can be configured
type Github ¶
type Github struct {
AccessToken string `mapstructure:"access_token"`
}
Github config, currently just an access token
type Jenkins ¶
type Jenkins struct { Host string Username string Password string Jobs JenkinsJobs }
Jenkins is the main Jenkins config, including credentials and the whitelisted jobs
type JenkinsJobs ¶
JenkinsJobs is the list of all (whitelisted) Jenkins jobs
func (JenkinsJobs) GetSortedNames ¶
func (j JenkinsJobs) GetSortedNames() []string
GetSortedNames get all defined job names, sorted by name
type Jira ¶
type Jira struct { Host string Username string Password string AccessToken string Project string Fields []JiraField }
Jira configuration: credentials and custom formatting options
type JiraField ¶
JiraField are custom Jira issue fields which should be displayed in the search/output Icons can be provided to have special mapping, e.g. for bug type or different priorities
type JobConfig ¶
type JobConfig struct { Parameters []JobParameter Trigger string OnStart []string OnSuccess []string OnFailure []string }
JobConfig concrete job configuration -> only defined jobs are (re)startable
type JobParameter ¶
JobParameter are defined build parameters per job
type Metrics ¶ added in v2.2.10
type Metrics struct { // e.g. use ":8082" to expose metrics on all interfaces PrometheusListener string `mapstructure:"prometheus_listener"` }
type Notifications ¶ added in v2.2.9
type Notifications struct { BuildStatusInProgress bool `mapstructure:"build_status_in_progress"` BuildStatusSuccess bool `mapstructure:"build_status_success"` BuildStatusFailed bool `mapstructure:"build_status_failed"` PullRequestStatusMergeable bool `mapstructure:"pr_status_mergeable"` }
Notifications can be defined in the config.yaml to enable notifications for pull request builds. the defaults are defined in default.go
type OpenWeather ¶
OpenWeather is an optional feature to get current weather
type PullRequest ¶
type PullRequest struct { // overwrite reactions, default ones, see default.go Reactions PullRequestReactions `mapstructure:"reactions"` // enable private notifications for the build status Notifications Notifications `mapstructure:"notifications"` // able to set a custom "approved" reactions to see directly who or which component/department approved a pullrequest CustomApproveReaction map[string]util.Reaction `mapstructure:"custom_approve_reaction"` }
PullRequest special configuration to change the pull request behavior
type PullRequestReactions ¶
type PullRequestReactions struct { InReview util.Reaction `mapstructure:"in_review"` Approved util.Reaction `mapstructure:"approved"` Merged util.Reaction `mapstructure:"merged"` Closed util.Reaction `mapstructure:"closed"` BuildSuccess util.Reaction `mapstructure:"build_success"` BuildRunning util.Reaction `mapstructure:"build_running"` BuildFailed util.Reaction `mapstructure:"build_failed"` Error util.Reaction `mapstructure:"error"` }
PullRequestReactions can be defined in the config.yaml to have custom reactions for pull requests. the defaults are defined in default.go
type Slack ¶
type Slack struct { Token string `mapstructure:"token"` SocketToken string `mapstructure:"socket_token"` AllowedGroups []string `mapstructure:"allowed_groups,flow"` ErrorChannel string `mapstructure:"error_channel"` Debug bool `mapstructure:"debug"` // only used for integration tests TestEndpointURL string `mapstructure:"-"` }
Slack contains the credentials and configuration of the Slack client
func (Slack) IsFakeServer ¶ added in v2.2.4
IsFakeServer is set for the "cli" tool which is spawning a fake test server which is mocking parts of the Slack API
type UserList ¶
type UserList []string
UserList is a wrapper for []string with some helper to check is a user is in the list (e.g. used for AdminUser list)