Documentation
¶
Overview ¶
prefix.go handles everything related to generating a prefix for the .ocelot / clone directory
Index ¶
- Constants
- func CheckBuildInConsul(consulete consul.Consuletty, hash string) (exists bool, err error)
- func CheckIfBuildDone(consulete consul.Consuletty, summary storage.BuildSum, gitHash string) bool
- func DetermineTopic(machineTag string) (topic string)
- func GetBuildRuntime(consulete consul.Consuletty, gitHash string) (map[string]*pb.BuildRuntimeInfo, error)
- func GetCloneDir(prefix, hash string) string
- func GetDockerUuidsByWerkerId(consulete consul.Consuletty, werkerId string) (uuids []string, err error)
- func GetHashRuntimesByWerker(consulete consul.Consuletty, werkerId string) (hrts map[string]*HashRuntime, err error)
- func GetOcelotDir(prefix string) string
- func GetOcyPrefixFromWerkerType(wt models.WerkType) string
- func GetPrefixDir(prefix string) string
- func GetTopics(tags []string) []string
- func GetWerkerActiveBuilds(consulete consul.Consuletty, werkerId string) (hashes []string, err error)
- type Builder
- type ErrBuildDone
- type HashRuntime
- type NotViable
- type OcelotValidator
- func (ov *OcelotValidator) ValidateBranchAgainstConf(buildConf *pb.BuildConfig, branch string) error
- func (ov *OcelotValidator) ValidateConfig(config *pb.BuildConfig, UI cli.Ui) error
- func (ov *OcelotValidator) ValidateViability(branch string, buildBranches []string, commits []*pb.Commit, force bool) error
- type OcyBash
- type RepoExecFunc
- type RepoSetupFunc
- type StageUtil
Constants ¶
const (
DEFAULT = "build"
)
Variables ¶
This section is empty.
Functions ¶
func CheckBuildInConsul ¶
func CheckBuildInConsul(consulete consul.Consuletty, hash string) (exists bool, err error)
func CheckIfBuildDone ¶
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 ¶
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 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 GetOcyPrefixFromWerkerType ¶
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 GetTopics ¶
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 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 ¶
NoViability will return a NotViable error, signaling it won't be queued and shouldn't be stored
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 RepoSetupFunc ¶
type StageUtil ¶
func CreateSubstage ¶
func InitStageUtil ¶
helper functions for stages, doesn't handle camelcase right now so if you want that set the values yourself explicitly
func (*StageUtil) GetStageLabel ¶
func (*StageUtil) SetStageLabel ¶
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
|
|
|
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. |