configuration

package
v0.0.0-...-ddb4624 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JenkinsBaseUrl is the base URL for the Jenkins CI server.
	JenkinsBaseUrl = "https://leeroy.dockerproject.org/build/retry"

	// FailingCILabel is the label that indicates that a pull request is
	// failing for a legitimate reason and should be ignored.
	FailingCILabel = "status/failing-ci"

	// PouleToken is injected as an HTML comment in the body of all messages
	// posted by the tool itself.
	PouleToken = "AUTOMATED:POULE"

	// PouleConfigurationFile is the name of the special file at the root of the repository.
	PouleConfigurationFile = "poule.yml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// Triggers is the collection of GitHub events that should trigger the action. The keys must be
	// valid GitHub event types (e.g., "pull_request"), and the value must be a list of alid values
	// for the action field of the GitHub paylost (e.g., "created").
	Triggers Trigger `yaml:"triggers"`

	// Operations to apply to all repositories when any trigger is met.
	Operations []OperationConfiguration `yaml:"operations"`
}

Action is the definition of an action: it descrbibes operations to apply when any of the associated triggers are met.

type Config

type Config struct {
	RunDelay   time.Duration `yaml:"delay"`
	DryRun     bool          `yaml:"dry_run"`
	Repository string        `yaml:"repository"`
	Token      string        `yaml:"token"`
	TokenFile  string        `yaml:"token_file"`
}

Config is the main configuration object for poule.

func FromGlobalFlags

func FromGlobalFlags(c *cli.Context) *Config

FromGlobalFlags creates a configuration object from command line flags.

func (*Config) Delay

func (c *Config) Delay() time.Duration

Delay is a helper function to get the delay in a time.Duration format

func (*Config) SplitRepository

func (c *Config) SplitRepository() (string, string)

SplitRepository returns the username and repository associated with the configuration.

func (*Config) Validate

func (c *Config) Validate() error

Validate verifies the validity of the configuration object.

type OperationConfiguration

type OperationConfiguration struct {
	Type     string                 `yaml:"type"`
	Filters  map[string]interface{} `yaml:"filters"`
	Settings map[string]interface{} `yaml:"settings"`
}

OperationConfiguration describes an operation.

type Server

type Server struct {
	Config      `yaml:",inline"`
	LookupdAddr string `yaml:"nsq_lookupd"`
	Channel     string `yaml:"nsq_channel"`

	// Repositories maps GitHub repositories full names their corresponding
	// NSQ topic.
	Repositories map[string]string `yaml:"repositories"`

	// CommonActions defines the triggers and operations which apply to every configured repository.
	CommonActions []Action `yaml:"common_configuration"`
}

Server is the configuration object for the server mode.

type StringSlice

type StringSlice []string

StringSlice is a slice of strings.

func (StringSlice) Contains

func (s StringSlice) Contains(item string) bool

Contains returns whether the StringSlice contains a given item.

type Trigger

type Trigger map[string]StringSlice

Trigger associates a GitHub event type (e.g., "issues", or "pull request") with a collection of corresponding actions (e.g., [ "opened", "reopened" ]).

func (Trigger) Contains

func (t Trigger) Contains(githubEvent, githubAction string) bool

Contains returns whether the triggers contains the specified (event, action) tuple.

Jump to

Keyboard shortcuts

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