common

package
v0.0.0-...-3bd1c47 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// BuilderLog is used to log messages of the builder module
	BuilderLog *log.Entry
	// ServiceLog is used to log messages of the web-service module
	ServiceLog *log.Entry
)
View Source
var DefaultConfig = `` /* 192-byte string literal not displayed */

DefaultConfig contains the default server configuration in YAML format.

Functions

func GenerateTmpDirName

func GenerateTmpDirName() string

GenerateTmpDirName will generate a 10-character random string to be used as a temp dir in the workspace directory.

func InitLogging

func InitLogging()

InitLogging sets the default logging behavior for logrus.

Types

type Config

type Config struct {
	Port     int    `yaml:"port"`      // The port the service will use
	BasePath string `yaml:"base_path"` // The base path for the hooks

	RecipesFilePath string `yaml:"recipes_file_path"`
	WorkspacePath   string `yaml:"workspace_path"`
	BuilderHostname string `yaml:"builder_hostname"`
	TaskQueueSize   int    `yaml:"task_queue_size"`
	CleanupBuilds   bool   `yaml:"cleanup_builds"`
}

The Config stores the current server configuration. There are default values for each property but it's meant to be customized through a YAML file.

func GetConfig

func GetConfig() *Config

GetConfig provides te current server configuration object

func LoadConfig

func LoadConfig() *Config

LoadConfig reads the configuration file and stores the data in related struct

type Recipe

type Recipe struct {
	Repository Repository `yaml:"repository"`
	Command    string     `yaml:"command"`
}

Recipe has a repo that is used to checkout the code and a command used to build it.

func (Recipe) IsHostedIn

func (r Recipe) IsHostedIn(title string) bool

IsHostedIn checks if the repo resides (hosted) on a specific git service by checking the URL.

type Recipes

type Recipes struct {
	All map[string]Recipe `yaml:",inline"`
}

Recipes is the container struct for all the available recipes to the system

func GetRecipes

func GetRecipes() *Recipes

GetRecipes provides the current recipes configuration object

func LoadRecipes

func LoadRecipes() *Recipes

LoadRecipes reads the recipes file and stores the config in the related data structure

type Repository

type Repository struct {
	Name   string `yaml:"name"`
	Branch string `yaml:"branch"`
	URL    string `yaml:"url"`
	SSH    *struct {
		KeyFile string `yaml:"keyfile"`
		// The environment variable that contains
		// the password
		PasswdEnv *string `yaml:"passenv"`
	} `yaml:"ssh"`
	VCS string `yaml:"vcs"`
}

Repository represents a code repo used in the building process

Jump to

Keyboard shortcuts

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