config

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (*Bitbucket) IsEnabled

func (c *Bitbucket) IsEnabled() bool

type Command added in v1.6.3

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"`
	Server      Server    `mapstructure:"server"`
	Jenkins     Jenkins   `mapstructure:"jenkins"`
	Jira        Jira      `mapstructure:"jira"`
	StoragePath string    `mapstructure:"storage_path"`
	Bitbucket   Bitbucket `mapstructure:"bitbucket"`
	Github      struct {
		AccessToken string `mapstructure:"access_token"`
	}
	Gitlab struct {
		AccessToken string
		Host        string
	}

	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

func Load added in v1.6.0

func Load(configFile string) (Config, error)

Load all yaml config from a directory or a single .yaml file

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 Jenkins

type Jenkins struct {
	Host     string
	Username string
	Password string
	Jobs     JenkinsJobs
}

Jenkins is the main Jenkins config, including credentials and the whitelisted jobs

func (Jenkins) IsEnabled

func (c Jenkins) IsEnabled() bool

IsEnabled checks if a host was defined...by default it's not set

type JenkinsJobs

type JenkinsJobs map[string]JobConfig

JenkinsJobs is the list of all (whitelisted) Jenkins jobs

func (JenkinsJobs) GetSortedNames added in v1.6.4

func (j JenkinsJobs) GetSortedNames() []string

get all defined job names, sorted by name

type Jira

type Jira struct {
	Host     string
	Username string
	Password string
	Project  string
	Fields   []JiraField
}

Jira configuration: credentials and custom formatting options

func (*Jira) IsEnabled

func (c *Jira) IsEnabled() bool

IsEnabled checks if a host is defined (username/password) is not needed for public projects

type JiraField

type JiraField struct {
	Name  string
	Icons map[string]string
}

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

type JobParameter struct {
	Name    string
	Default string
	Type    string
}

JobParameter are defined build parameters per job

type Logger

type Logger struct {
	Level string `mapstructure:"level"`
	File  string `mapstructure:"file"`
}

Logger configuration to define log target or log levels

type OpenWeather

type OpenWeather struct {
	Apikey   string
	Location string
	URL      string
	Units    string
}

OpenWeather is an optional feature to get current weather

type PullRequest added in v1.6.0

type PullRequest struct {
	// able to set a custom "approved" reactions to see directly who or which component/department approved a pullrequest
	CustomApproveReaction map[string]string `mapstructure:"custom_approve_reaction"`
}

PullRequest special configuration to change the pull request behavior

type Server

type Server struct {
	Listen        string `mapstructure:"listen"`
	SigningSecret string `mapstructure:"signing_secret"`
}

func (Server) IsEnabled added in v1.3.0

func (c Server) IsEnabled() bool

type Slack

type Slack struct {
	Token         string   `mapstructure:"token"`
	AllowedGroups []string `mapstructure:"allowed_groups,flow"`
	ErrorChannel  string   `mapstructure:"error_channel"`

	Debug       bool `mapstructure:"debug"`
	UseEventAPI bool `mapstructure:"use_event_api"`

	// only used for integration tests
	TestEndpointURL string `mapstructure:"-"`
}

Slack contains the credentials and configuration of the Slack client

type UserList added in v1.6.2

type UserList []string

func (UserList) Contains added in v1.6.2

func (l UserList) Contains(userID string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL