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 OpenWeather
- type PullRequest
- type PullRequestReactions
- type Slack
- type UserList
- type UserMap
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{ Reactions: PullRequestReactions{ InReview: "eyes", Approved: "white_check_mark", Merged: "twisted_rightwards_arrows", Closed: "x", BuildFailed: "fire", BuildRunning: "arrows_counterclockwise", Error: "x", }, }, }
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"`
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"`
// @deprecated
BranchLookup struct {
Type string // stash/bitbucket/git/null
Repository string
} `mapstructure:"branch_lookup"`
AllowedUsers UserList `mapstructure:"allowed_users,flow"`
AdminUsers UserList `mapstructure:"admin_users,flow"`
OpenWeather OpenWeather `mapstructure:"open_weather"`
PullRequest PullRequest `mapstructure:"pullrequest"`
Timezone string `mapstructure:"timezone"`
}
Config contains the full config structure of this bot
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 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"`
// 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"`
BuildFailed util.Reaction `mapstructure:"build_failed"`
BuildRunning util.Reaction `mapstructure:"build_running"`
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) CanHandleInteractions ¶
CanHandleInteractions checks if the slack config supports interaction/event via "Socket Mode" API in this case some commands are adding buttons to messages which are more advanced
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