build

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

prefix.go handles everything related to generating a prefix for the .ocelot / clone directory

Index

Constants

View Source
const (
	DEFAULT = "build"
)

Variables

This section is empty.

Functions

func CheckBuildInConsul

func CheckBuildInConsul(consulete consul.Consuletty, hash string) (exists bool, err error)

func CheckIfBuildDone

func CheckIfBuildDone(consulete consul.Consuletty, summary storage.BuildSum, gitHash string) bool

CheckIfBuildDone will check in consul to make sure there is nothing in runtime configuration anymore, then it will makes sure it can find it in storage

func DetermineTopic

func DetermineTopic(machineTag string) (topic string)

DetermineTopic will return the correct topic based on the value of machineTag

func GetBuildRuntime

func GetBuildRuntime(consulete consul.Consuletty, gitHash string) (map[string]*pb.BuildRuntimeInfo, error)

GetBuildRuntime will return BuildRuntimeInfo about matching partial git hashes. It does this by first asking consul for state of builds, and then db storage

func GetCloneDir

func GetCloneDir(prefix, hash string) string

func GetDockerUuidsByWerkerId

func GetDockerUuidsByWerkerId(consulete consul.Consuletty, werkerId string) (uuids []string, err error)

func GetHashRuntimesByWerker

func GetHashRuntimesByWerker(consulete consul.Consuletty, werkerId string) (hrts map[string]*HashRuntime, err error)

func GetOcelotDir

func GetOcelotDir(prefix string) string

func GetOcyPrefixFromWerkerType

func GetOcyPrefixFromWerkerType(wt models.WerkType) string

GetOcyPrefixFromWerkerType will return "" for anything that runs in a container because root access can be assumed If it is running with the BARE connection (ie mac builds) or via Exec then it will find the home direc and use that as the prefix for the .ocelot directory

func GetPrefixDir

func GetPrefixDir(prefix string) string

func GetTopics

func GetTopics(tags []string) []string

GetTopics will return the list of topics that the werker should subscribe to as defined by

Right now, the only types that change the topic list are SSH and EXEC

func GetWerkerActiveBuilds

func GetWerkerActiveBuilds(consulete consul.Consuletty, werkerId string) (hashes []string, err error)

Types

type Builder

type Builder interface {
	OcyBash
	Init(ctx context.Context, hash string, logout chan []byte) *pb.Result
	// for during setup stage, on instantiation of build
	SetGlobalEnv(envs []string)
	// for after that, if an integration calls for an environment variable to be set (i.e. the creds option for uploading env vars for use)
	AddGlobalEnvs(envs []string)
	Setup(ctx context.Context, logout chan []byte, dockerId chan string, werk *pb.WerkerTask, rc cred.CVRemoteConfig, werkerPort string) (res *pb.Result, uuid string)
	Execute(ctx context.Context, actions *pb.Stage, logout chan []byte, commitHash string) *pb.Result
	ExecuteIntegration(ctx context.Context, stage *pb.Stage, stgUtil *StageUtil, logout chan []byte) *pb.Result
	GetContainerId() string

	io.Closer
}

type ErrBuildDone

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

func (*ErrBuildDone) Error

func (e *ErrBuildDone) Error() string

type HashRuntime

type HashRuntime struct {
	DockerUuid   string
	BuildId      int64
	CurrentStage string
	Hash         string
	StageStart   time.Time
}

type NotViable

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

NotViable is an error that means that this commit should not be queued for a build

func NoViability

func NoViability(msg string) *NotViable

NoViability will return a NotViable error, signaling it won't be queued and shouldn't be stored

func (*NotViable) Error

func (dq *NotViable) Error() string

type OcelotValidator

type OcelotValidator struct{}

contains all validators for commands as recognized by ocelot <command> [args]

func GetOcelotValidator

func GetOcelotValidator() *OcelotValidator

func (*OcelotValidator) ValidateBranchAgainstConf

func (ov *OcelotValidator) ValidateBranchAgainstConf(buildConf *pb.BuildConfig, branch string) error

func (*OcelotValidator) ValidateConfig

func (ov *OcelotValidator) ValidateConfig(config *pb.BuildConfig, UI cli.Ui) error

validates config, takes in an optional cli out

func (*OcelotValidator) ValidateViability

func (ov *OcelotValidator) ValidateViability(branch string, buildBranches []string, commits []*pb.Commit, force bool) error

ValidateViability will check:

  • the branch given is a regex match for one of the buildBranches
  • the commits in commits don't have any messages containing special skip commands ([skip ci]/[ci skip])

This can be overriden with force If the validation fails, a NotViable error will be returned. This means that you should not queue the build or track it. its unworthy.

type OcyBash

type OcyBash interface {
	GetBbDownloadURL() string
	GetGithubDownloadURL() string
	SetBbDownloadURL(downloadURL string)
	SetGithubDownloadURL(downloadURL string)
	DownloadCodebase(werk *pb.WerkerTask) []string
	DownloadSSHKey(vaultKey, vaultPath string) []string
	DownloadTemplateFiles(werkerPort string) []string
	DownloadKubectl(werkerPort string) []string
	CDAndRunCmds(cmds []string, commitHash string) []string
}

type RepoExecFunc

type RepoExecFunc func(string) []string

type RepoSetupFunc

type RepoSetupFunc func(rc cred.CVRemoteConfig, store storage.CredTable, accountName string) (string, error)

type StageUtil

type StageUtil struct {
	Stage      string
	StageLabel string
}

func CreateSubstage

func CreateSubstage(stg *StageUtil, subStage string) *StageUtil

func InitStageUtil

func InitStageUtil(stage string) *StageUtil

helper functions for stages, doesn't handle camelcase right now so if you want that set the values yourself explicitly

func (*StageUtil) GetStage

func (s *StageUtil) GetStage() string

func (*StageUtil) GetStageLabel

func (s *StageUtil) GetStageLabel() string

func (*StageUtil) SetStage

func (s *StageUtil) SetStage(stage string)

func (*StageUtil) SetStageLabel

func (s *StageUtil) SetStageLabel(stageLabel string)

Directories

Path Synopsis
The basher package contains the interface for and implementation of the shell commands that will eventually be exucted for each build.
The basher package contains the interface for and implementation of the shell commands that will eventually be exucted for each build.
builder
k8s
ssh
valet is responsible for keeping track of all the active builds on the werker There are two different types; the context valet and the (build) valet.
valet is responsible for keeping track of all the active builds on the werker There are two different types; the context valet and the (build) valet.

Jump to

Keyboard shortcuts

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