bazooka

package
v0.0.0-...-616e5a8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2016 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	JOB_SUCCESS JobStatus = "SUCCESS"
	JOB_FAILED            = "FAILED"
	JOB_ERRORED           = "ERRORED"
	JOB_RUNNING           = "RUNNING"
)

Variables

View Source
var (
	PrivateKey []byte
)

Functions

func AppendToFile

func AppendToFile(path, text string, perm os.FileMode) error

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func Decrypt

func Decrypt(key, text []byte) ([]byte, error)

Decrypt decrypts some data with the key

func Encrypt

func Encrypt(key, text []byte) ([]byte, error)

Encrypt encrypts some data with the key

func FileExists

func FileExists(path string) (bool, error)

func Flush

func Flush(object interface{}, outputFile string) error

func GetEnvMap

func GetEnvMap(envArray []BzkString) map[string][]BzkString

func ListFilesWithPrefix

func ListFilesWithPrefix(source, prefix string) ([]string, error)

func LoadCryptoKeyFromFile

func LoadCryptoKeyFromFile(filePath string) error

func Parse

func Parse(file string, object interface{}) error

func ReadCryptoKey

func ReadCryptoKey(filePath string) ([]byte, error)

func RemoveContainer

func RemoveContainer(container *docker.Container)

RemoveContainer will cleanly remove a Docker container and warn user of a leak in case of error

func ResolveConfigFile

func ResolveConfigFile(source string) (string, error)

func SplitNameValue

func SplitNameValue(s string) (string, string)

func WaitForTcpConnection

func WaitForTcpConnection(url string, retryEvery, timeout time.Duration) error

Types

type BzkString

type BzkString struct {
	Name    string
	Value   string
	Secured bool
}

func FlattenEnvMap

func FlattenEnvMap(mapp map[string][]BzkString) []BzkString

func (BzkString) MarshalYAML

func (c BzkString) MarshalYAML() (interface{}, error)

func (*BzkString) UnmarshalYAML

func (c *BzkString) UnmarshalYAML(unmarshal func(interface{}) error) error

type Commands

type Commands []string

func (*Commands) UnmarshalYAML

func (c *Commands) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

type Config

type Config struct {
	Language       string       `yaml:"language,omitempty"`
	Image          Images       `yaml:"image,omitempty"`
	Setup          Commands     `yaml:"setup,omitempty"`
	BeforeInstall  Commands     `yaml:"before_install,omitempty"`
	Install        Commands     `yaml:"install,omitempty"`
	BeforeScript   Commands     `yaml:"before_script,omitempty"`
	Script         Commands     `yaml:"script,omitempty"`
	AfterScript    Commands     `yaml:"after_script,omitempty"`
	AfterSuccess   Commands     `yaml:"after_success,omitempty"`
	AfterFailure   Commands     `yaml:"after_failure,omitempty"`
	Services       []Service    `yaml:"services,omitempty"`
	Env            []BzkString  `yaml:"env,omitempty"`
	FromImage      string       `yaml:"from"`
	Matrix         ConfigMatrix `yaml:"matrix,omitempty"`
	Archive        Globs        `yaml:"archive,omitempty"`
	ArchiveSuccess Globs        `yaml:"archive_success,omitempty"`
	ArchiveFailure Globs        `yaml:"archive_failure,omitempty"`
}

type ConfigMatrix

type ConfigMatrix struct {
	Exclude []map[string]interface{} `yaml:"exclude,omitempty"`
}

type CryptoKey

type CryptoKey struct {
	ID        string `bson:"id" json:"id"`
	Content   []byte `bson:"content" json:"content"`
	ProjectID string `bson:"project_id" json:"project_id"`
}

type FinishData

type FinishData struct {
	Status    JobStatus `json:"status"`
	Time      time.Time `json:"time,omitempty"`
	Artifacts []string  `json:"artifacts,omitempty"`
}

type Globs

type Globs []string

func (*Globs) UnmarshalYAML

func (g *Globs) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

type Image

type Image struct {
	Name        string `bson:"name" json:"name"`
	Description string `bson:"description" json:"description"`
	Image       string `bson:"image" json:"image"`
	ID          string `bson:"id" json:"id"`
}

type Images

type Images []string

func (*Images) UnmarshalYAML

func (im *Images) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

type Job

type Job struct {
	ID              string      `bson:"id" json:"id"`
	Number          int         `bson:"number" json:"number"`
	ProjectID       string      `bson:"project_id" json:"project_id"`
	OrchestrationID string      `bson:"orchestration_id" json:"orchestration_id"`
	Started         time.Time   `bson:"started" json:"started"`
	Completed       time.Time   `bson:"completed" json:"completed"`
	Status          JobStatus   `bson:"status" json:"status"`
	SCMMetadata     SCMMetadata `bson:"scm_metadata" json:"scm_metadata"`
	Parameters      []string    `bson:"parameters" json:"parameters"`
}

type JobStatus

type JobStatus string

type LogEntry

type LogEntry struct {
	ID        string    `bson:"id" json:"id"`
	Message   string    `bson:"msg" json:"msg"`
	Time      time.Time `bson:"time" json:"time"`
	Level     string    `bson:"level" json:"level"`
	Phase     string    `bson:"phase" json:"phase"`
	Command   string    `bson:"command" json:"command"`
	ProjectID string    `bson:"project_id" json:"project_id"`
	JobID     string    `bson:"job_id" json:"job_id"`
	VariantID string    `bson:"variant_id" json:"variant_id"`
	Image     string    `bson:"image" json:"image"`
}

func ConstructLog

func ConstructLog(message string, template LogEntry) LogEntry

type MetaKind

type MetaKind string
const (
	META_ENV  MetaKind = "env"
	META_LANG          = "lang"
)

type Person

type Person struct {
	Name  string `bson:"name" json:"name" yaml:"name"`
	Email string `bson:"email" json:"email" yaml:"email"`
}

type Project

type Project struct {
	ScmType    string            `bson:"scm_type" json:"scm_type" validate:"required"`
	ScmURI     string            `bson:"scm_uri" json:"scm_uri" validate:"required"`
	Name       string            `bson:"name" json:"name" validate:"required"`
	ID         string            `bson:"id" json:"id"`
	HookKey    string            `bson:"hook_key" json:"hook_key"`
	JobCounter int               `bson:"job_counter" json:"job_counter"`
	Config     map[string]string `bson:"config" json:"config"`
}

type ProjectWithStatus

type ProjectWithStatus struct {
	*Project
	LastJob *Job `json:"last_job"`
}

type SCMMetadata

type SCMMetadata struct {
	Origin    string   `bson:"origin" json:"origin" yaml:"origin"`
	Reference string   `bson:"reference" json:"reference" yaml:"reference"`
	CommitID  string   `bson:"commit_id" json:"commit_id" yaml:"commit_id"`
	Author    Person   `bson:"author" json:"author" yaml:"author"`
	Committer Person   `bson:"committer" json:"committer" yaml:"committer"`
	Date      YamlTime `bson:"time" json:"date" yaml:"date"`
	Message   string   `bson:"message" json:"message" yaml:"message"`
}

type SSHKey

type SSHKey struct {
	ID        string `bson:"id" json:"id"`
	Content   string `bson:"content" json:"content"`
	ProjectID string `bson:"project_id" json:"project_id"`
}

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(reader io.Reader) *Scanner

func (*Scanner) Err

func (s *Scanner) Err() error

func (*Scanner) Scan

func (s *Scanner) Scan() bool

func (*Scanner) Text

func (s *Scanner) Text() string

type Service

type Service struct {
	Image string `yaml:"image"`
	Alias string `yaml:"alias,omitempty"`
}

Service is the representation of a a linked Docker container for the build

type StartJob

type StartJob struct {
	ScmReference string   `json:"reference"`
	Parameters   []string `json:"parameters"`
}

type StringValue

type StringValue struct {
	Value string `bson:"value" json:"value" validate:"required"`
}

type User

type User struct {
	ID       string `bson:"id" json:"id"`
	Email    string `bson:"email" json:"email"`
	Password string `bson:"password" json:"password"`
}

type Variant

type Variant struct {
	Status     JobStatus     `bson:"status" json:"status"`
	Started    time.Time     `bson:"started" json:"started"`
	Completed  time.Time     `bson:"completed" json:"completed"`
	BuildImage string        `bson:"image" json:"image"`
	ProjectID  string        `bson:"project_id" json:"project_id"`
	JobID      string        `bson:"job_id" json:"job_id"`
	Number     int           `bson:"number" json:"number"`
	ID         string        `bson:"id" json:"id"`
	Metas      *VariantMetas `bson:"metas" json:"metas"`
	Artifacts  []string      `bson:"artifacts" json:"artifacts"`
}

type VariantMeta

type VariantMeta struct {
	Kind  MetaKind `bson:"kind" json:"kind"`
	Name  string   `bson:"name" json:"name"`
	Value string   `bson:"value" json:"value"`
}

type VariantMetas

type VariantMetas []*VariantMeta

func (*VariantMetas) Append

func (ms *VariantMetas) Append(m *VariantMeta)

func (*VariantMetas) Len

func (ms *VariantMetas) Len() int

func (*VariantMetas) Less

func (ms *VariantMetas) Less(i, j int) bool

func (*VariantMetas) Swap

func (ms *VariantMetas) Swap(i, j int)

type YamlTime

type YamlTime struct {
	time.Time
}

func (*YamlTime) UnmarshalYAML

func (t *YamlTime) UnmarshalYAML(unmarshal func(interface{}) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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