Documentation
¶
Overview ¶
Package core contains the entire implementation of the Laforge configuration language. It includes it's own loader and dependency resolution mechanisms and is meant to be the source of truth around declaration logic.
Index ¶
- Constants
- Variables
- func BuildDirFromEnvRoot(envroot string) string
- func CalculateTerraformNeeds(plan *Plan) (map[string][]string, error)
- func ConnectFunc(network, addr string) func() (net.Conn, error)
- func CreateGlobalConfig(u User) error
- func Decr(i int) int
- func DependencyCost(d Dependency) int64
- func DependencyType(d Dependency) string
- func ExampleObjectByName(name string) ([]byte, error)
- func FileGlobResolver(baseDir string, parser *hcl2parse.Parser, loader *Loader) include.Resolver
- func FindTerraformExecutable() (string, error)
- func GetEmptyObjByName(s string) (interface{}, error)
- func GetTeamIDFromPath(p string) (string, error)
- func GlobalConfigDir() (string, error)
- func HCLBytesToObject(data []byte, v interface{}) error
- func HashConfigMap(m map[string]string) []uint64
- func IPv42Int(ip net.IP) uint32
- func InitializeBuildDirectory(l *Laforge, overwrite, update bool) error
- func Int2IPv4(nn uint32) net.IP
- func IsGlobalType(p string) bool
- func LoadHCLFromFile(fileloc string, v interface{}) error
- func LocateBaseConfig() (string, error)
- func LocateBuildConfig() (string, error)
- func LocateEnvConfig() (string, error)
- func LocateGlobalConfig() (string, error)
- func LocateTeamConfig() (string, error)
- func NewMergeConflict(base, layer interface{}, baseid, layerid string, ...) error
- func OutdatedID(id string) bool
- func PathExists(loc string) bool
- func QuotedHCLString(s string) string
- func RenderHCLv2Object(i interface{}) ([]byte, error)
- func SSHClientConfig(sshconf *SSHAuthConfig, overrideKey string) (*ssh.ClientConfig, error)
- func StatusMap(curr StateContext) string
- func TouchGitKeep(p string) error
- func TraverseUpForFile(filename, startdir string) (string, error)
- func UnsafeStringAsInt(s string) int
- func UserWizard() error
- func ValidEnvName(name string) bool
- func ValidID(id string) bool
- func ValidateGenericPath(p string) error
- type AMI
- type Build
- func (b *Build) AssetForTeam(teamID int, assetName string) string
- func (b *Build) Associate(g *Snapshot) error
- func (b *Build) Base() string
- func (b *Build) CreateTeam(tid int) *Team
- func (b *Build) CreateTeams() error
- func (b *Build) Gather(g *Snapshot) error
- func (b *Build) GetCaller() Caller
- func (b *Build) GetOnConflict() OnConflict
- func (b *Build) Hash() uint64
- func (b *Build) LaforgeID() string
- func (v Build) MarshalEasyJSON(w *jwriter.Writer)
- func (v Build) MarshalJSON() ([]byte, error)
- func (b *Build) ParentLaforgeID() string
- func (b *Build) Path() string
- func (b *Build) RelAssetForTeam(networkBase, hostBase, assetName string) string
- func (b *Build) SetCaller(ca Caller)
- func (b *Build) SetID() string
- func (b *Build) SetOnConflict(o OnConflict)
- func (b *Build) Swap(m Mergeable) error
- func (v *Build) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Build) UnmarshalJSON(data []byte) error
- func (b *Build) ValidatePath() error
- type CallFile
- type Caller
- type ChecksumList
- func (c ChecksumList) Hash() uint64
- func (c ChecksumList) Len() int
- func (c ChecksumList) Less(i, j int) bool
- func (v ChecksumList) MarshalEasyJSON(w *jwriter.Writer)
- func (v ChecksumList) MarshalJSON() ([]byte, error)
- func (c ChecksumList) Swap(i, j int)
- func (v *ChecksumList) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ChecksumList) UnmarshalJSON(data []byte) error
- type Command
- func (c *Command) Base() string
- func (c *Command) CommandString() string
- func (c *Command) Fullpath() string
- func (c *Command) Gather(g *Snapshot) error
- func (c *Command) GetCaller() Caller
- func (c *Command) GetOnConflict() OnConflict
- func (c *Command) Hash() uint64
- func (c *Command) Kind() string
- func (c *Command) LaforgeID() string
- func (v Command) MarshalEasyJSON(w *jwriter.Writer)
- func (v Command) MarshalJSON() ([]byte, error)
- func (c *Command) ParentLaforgeID() string
- func (c *Command) Path() string
- func (c *Command) SetCaller(ca Caller)
- func (c *Command) SetOnConflict(o OnConflict)
- func (c *Command) Swap(m Mergeable) error
- func (v *Command) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Command) UnmarshalJSON(data []byte) error
- func (c *Command) ValidatePath() error
- type CommandJob
- func (j *CommandJob) CanProceed() error
- func (j *CommandJob) CleanUp() error
- func (j *CommandJob) Do() error
- func (j *CommandJob) EnsureDependencies(l *Laforge) error
- func (j *CommandJob) Finish() error
- func (v CommandJob) MarshalEasyJSON(w *jwriter.Writer)
- func (v CommandJob) MarshalJSON() ([]byte, error)
- func (v *CommandJob) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *CommandJob) UnmarshalJSON(data []byte) error
- type Competition
- func (c *Competition) Base() string
- func (c *Competition) GetCaller() Caller
- func (c *Competition) GetOnConflict() OnConflict
- func (c *Competition) Hash() uint64
- func (c *Competition) LaforgeID() string
- func (v Competition) MarshalEasyJSON(w *jwriter.Writer)
- func (v Competition) MarshalJSON() ([]byte, error)
- func (c *Competition) PasswordForHost(h *Host) string
- func (c *Competition) Path() string
- func (c *Competition) SetCaller(ca Caller)
- func (c *Competition) SetOnConflict(oc OnConflict)
- func (c *Competition) Swap(m Mergeable) error
- func (v *Competition) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Competition) UnmarshalJSON(data []byte) error
- func (c *Competition) ValidatePath() error
- type Connection
- func (c *Connection) Base() string
- func (c *Connection) DeleteScriptSFTP(remotefile string) error
- func (c *Connection) ExecuteCommand(cmd *RemoteCommand) error
- func (c *Connection) ExecuteCommandSSH(cmd *RemoteCommand) error
- func (c *Connection) ExecuteCommandWinRM(cmd *RemoteCommand) error
- func (c *Connection) Gather(s *Snapshot) error
- func (c *Connection) GetCaller() Caller
- func (c *Connection) GetOnConflict() OnConflict
- func (c *Connection) Hash() uint64
- func (c *Connection) InteractiveSSH() error
- func (c *Connection) InteractiveWinRM() error
- func (c *Connection) IsSSH() bool
- func (c *Connection) IsWinRM() bool
- func (c *Connection) LaforgeID() string
- func (v Connection) MarshalEasyJSON(w *jwriter.Writer)
- func (v Connection) MarshalJSON() ([]byte, error)
- func (c *Connection) ParentLaforgeID() string
- func (c *Connection) Path() string
- func (c *Connection) RemoteShell() error
- func (c *Connection) SetCaller(ca Caller)
- func (c *Connection) SetID() string
- func (c *Connection) SetOnConflict(o OnConflict)
- func (c *Connection) Swap(m Mergeable) error
- func (v *Connection) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Connection) UnmarshalJSON(data []byte) error
- func (c *Connection) Upload(src, dst string) error
- func (c *Connection) UploadExecuteAndDelete(scriptsrc string, tmpname string, logdir string) error
- func (c *Connection) UploadSCP(src, dst string) error
- func (c *Connection) UploadSFTP(src, dst string) error
- func (c *Connection) UploadScriptSFTP(src, dst string) error
- func (c *Connection) UploadWinRM(src, dst string) error
- func (c *Connection) ValidatePath() error
- type DNS
- func (d *DNS) GetCaller() Caller
- func (d *DNS) GetOnConflict() OnConflict
- func (d *DNS) Hash() uint64
- func (d *DNS) LaforgeID() string
- func (v DNS) MarshalEasyJSON(w *jwriter.Writer)
- func (v DNS) MarshalJSON() ([]byte, error)
- func (d *DNS) SetCaller(c Caller)
- func (d *DNS) SetOnConflict(o OnConflict)
- func (d *DNS) Swap(m Mergeable) error
- func (v *DNS) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *DNS) UnmarshalJSON(data []byte) error
- type DNSRecord
- func (r *DNSRecord) Base() string
- func (r *DNSRecord) Fullpath() string
- func (r *DNSRecord) Gather(g *Snapshot) error
- func (r *DNSRecord) GetCaller() Caller
- func (r *DNSRecord) GetOnConflict() OnConflict
- func (r *DNSRecord) Hash() uint64
- func (r *DNSRecord) Inherited() bool
- func (r *DNSRecord) Kind() string
- func (r *DNSRecord) LaforgeID() string
- func (v DNSRecord) MarshalEasyJSON(w *jwriter.Writer)
- func (v DNSRecord) MarshalJSON() ([]byte, error)
- func (r *DNSRecord) ParentLaforgeID() string
- func (r *DNSRecord) Path() string
- func (r *DNSRecord) SetCaller(c Caller)
- func (r *DNSRecord) SetOnConflict(o OnConflict)
- func (r *DNSRecord) SetValue(val string)
- func (r *DNSRecord) Swap(m Mergeable) error
- func (v *DNSRecord) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *DNSRecord) UnmarshalJSON(data []byte) error
- func (r *DNSRecord) ValidatePath() error
- type DNSRecordJob
- func (j *DNSRecordJob) CanProceed() error
- func (j *DNSRecordJob) CleanUp() error
- func (j *DNSRecordJob) Do() error
- func (j *DNSRecordJob) EnsureDependencies(l *Laforge) error
- func (j *DNSRecordJob) Finish() error
- func (v DNSRecordJob) MarshalEasyJSON(w *jwriter.Writer)
- func (v DNSRecordJob) MarshalJSON() ([]byte, error)
- func (v *DNSRecordJob) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *DNSRecordJob) UnmarshalJSON(data []byte) error
- type Dependency
- type DependencyList
- type Disk
- type Doer
- type Edge
- type Environment
- func (e *Environment) Base() string
- func (e *Environment) CreateBuild() *Build
- func (e *Environment) Gather(g *Snapshot) error
- func (e *Environment) GetCaller() Caller
- func (e *Environment) GetOnConflict() OnConflict
- func (e *Environment) Hash() uint64
- func (e *Environment) LaforgeID() string
- func (v Environment) MarshalEasyJSON(w *jwriter.Writer)
- func (v Environment) MarshalJSON() ([]byte, error)
- func (e *Environment) ParentLaforgeID() string
- func (e *Environment) Path() string
- func (e *Environment) ResolveIncludedNetworks(base *Laforge) error
- func (e *Environment) SetCaller(c Caller)
- func (e *Environment) SetOnConflict(o OnConflict)
- func (e *Environment) Swap(m Mergeable) error
- func (v *Environment) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Environment) UnmarshalJSON(data []byte) error
- func (e *Environment) ValidatePath() error
- type ExitError
- type Finding
- type FindingDifficulty
- type FindingSeverity
- type GenericJob
- func (j *GenericJob) CurrentStatus() JobStatus
- func (j *GenericJob) GetID() string
- func (j *GenericJob) GetMetadata() *Metadata
- func (j *GenericJob) GetTargetID() string
- func (j *GenericJob) Hash() uint64
- func (v GenericJob) MarshalEasyJSON(w *jwriter.Writer)
- func (v GenericJob) MarshalJSON() ([]byte, error)
- func (j *GenericJob) SetBase(l *Laforge)
- func (j *GenericJob) SetPlan(p *Plan)
- func (j *GenericJob) SetStatus(s JobStatus)
- func (j *GenericJob) SetTimeout(t int)
- func (v *GenericJob) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *GenericJob) UnmarshalJSON(data []byte) error
- type Host
- func (h *Host) Base() string
- func (h *Host) CalcIP(subnet string) string
- func (h *Host) DependencyCount(e *Environment) int
- func (h *Host) FinalStepID() int
- func (h *Host) Fullpath() string
- func (h *Host) Gather(g *Snapshot) error
- func (h *Host) GetCaller() Caller
- func (h *Host) GetDependencyHash() string
- func (h *Host) GetOnConflict() OnConflict
- func (h *Host) GetProvisionersHash() uint64
- func (h *Host) HasTag(tag string) bool
- func (h *Host) Hash() uint64
- func (h *Host) Index(base *Laforge) error
- func (h *Host) IsWindows() bool
- func (h *Host) LaforgeID() string
- func (v Host) MarshalEasyJSON(w *jwriter.Writer)
- func (v Host) MarshalJSON() ([]byte, error)
- func (h *Host) ParentLaforgeID() string
- func (h *Host) Path() string
- func (h *Host) SetCaller(c Caller)
- func (h *Host) SetOnConflict(o OnConflict)
- func (h *Host) Swap(m Mergeable) error
- func (h *Host) TagEquals(tag, value string) bool
- func (v *Host) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Host) UnmarshalJSON(data []byte) error
- func (h *Host) ValidatePath() error
- type HostDependency
- type IO
- type Identity
- func (i *Identity) Base() string
- func (i *Identity) GetCaller() Caller
- func (i *Identity) GetOnConflict() OnConflict
- func (i *Identity) Hash() uint64
- func (i *Identity) LaforgeID() string
- func (v Identity) MarshalEasyJSON(w *jwriter.Writer)
- func (v Identity) MarshalJSON() ([]byte, error)
- func (i *Identity) Path() string
- func (i *Identity) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error
- func (i *Identity) SetCaller(c Caller)
- func (i *Identity) SetOnConflict(o OnConflict)
- func (i *Identity) Swap(m Mergeable) error
- func (v *Identity) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Identity) UnmarshalJSON(data []byte) error
- func (i *Identity) ValidatePath() error
- type Include
- type IncludedNetwork
- type JobStatus
- type LFType
- type Laforge
- func Bootstrap() (*Laforge, error)
- func InitializeBaseContext(globalconfig, baseconfig string) (*Laforge, error)
- func InitializeBuildContext(globalconfig, buildconfig string) (*Laforge, error)
- func InitializeEnvContext(globalconfig, envconfig string) (*Laforge, error)
- func InitializeTeamContext(globalconfig, buildconfig, teamconfig string) (*Laforge, error)
- func LoadFiles(envpath ...string) (*Laforge, error)
- func Mask(base, layer *Laforge) (*Laforge, error)
- func (l *Laforge) AssertExactContext(s StateContext) error
- func (l *Laforge) AssertMinContext(s StateContext) error
- func (l *Laforge) BaseConfigFile() string
- func (l *Laforge) BuildConfigFile() string
- func (l *Laforge) CleanBuildDirectory(overwrite bool) error
- func (l *Laforge) CreateIndex()
- func (l *Laforge) CurrentStateManager() (*State, error)
- func (l *Laforge) EnvConfigFile() string
- func (l *Laforge) GetAllEnvs() (map[string]*Laforge, error)
- func (l *Laforge) GetContext() StateContext
- func (l *Laforge) GlobalConfigFile() string
- func (l *Laforge) IdentitiesWithVarEquals(key, value string) []*Identity
- func (l *Laforge) IndexBuildDependencies() error
- func (l *Laforge) IndexConnectionDependencies() error
- func (l *Laforge) IndexEnvironmentDependencies() error
- func (l *Laforge) IndexHostDependencies() error
- func (l *Laforge) IndexProvisionedHostDependencies() error
- func (l *Laforge) IndexProvisionedNetworkDependencies() error
- func (l *Laforge) IndexProvisioningStepDependencies() error
- func (l *Laforge) IndexTeamDependencies() error
- func (l *Laforge) InitializeBaseDirectory(overwrite bool) error
- func (l *Laforge) InitializeContext() error
- func (l *Laforge) InitializeEnv(name string, overwrite bool) error
- func (l *Laforge) LoadFromContext() error
- func (v Laforge) MarshalEasyJSON(w *jwriter.Writer)
- func (v Laforge) MarshalJSON() ([]byte, error)
- func (l *Laforge) TeamConfigFile() string
- func (l *Laforge) UniqIdentityVarValues(key string) []string
- func (v *Laforge) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Laforge) UnmarshalJSON(data []byte) error
- func (l *Laforge) Update(diff *Laforge) (*Laforge, error)
- type Loader
- type Local
- type LocalFileRef
- type Manager
- type Mergeable
- type MetaResource
- type Metadata
- func (m *Metadata) CalculateChecksum()
- func (m *Metadata) DotNode(s string, d *dag.DotOpts) *dag.DotNode
- func (m *Metadata) FillColor() string
- func (m *Metadata) GetChecksum() uint64
- func (m *Metadata) GetID() string
- func (m *Metadata) Hash() uint64
- func (m *Metadata) Hashcode() interface{}
- func (m *Metadata) IsGlobalType() bool
- func (m *Metadata) Label() string
- func (v Metadata) MarshalEasyJSON(w *jwriter.Writer)
- func (v Metadata) MarshalJSON() ([]byte, error)
- func (m *Metadata) Shape() string
- func (m *Metadata) String() string
- func (m *Metadata) Style() string
- func (m *Metadata) ToRevision() *Revision
- func (m *Metadata) TypeByPath() LFType
- func (v *Metadata) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Metadata) UnmarshalJSON(data []byte) error
- type Network
- func (n *Network) Base() string
- func (n *Network) Gather(g *Snapshot) error
- func (n *Network) GetCaller() Caller
- func (n *Network) GetOnConflict() OnConflict
- func (n *Network) Hash() uint64
- func (n *Network) LaforgeID() string
- func (v Network) MarshalEasyJSON(w *jwriter.Writer)
- func (v Network) MarshalJSON() ([]byte, error)
- func (n *Network) Octet() string
- func (n *Network) ParentLaforgeID() string
- func (n *Network) Path() string
- func (n *Network) SetCaller(c Caller)
- func (n *Network) SetOnConflict(o OnConflict)
- func (n *Network) Swap(m Mergeable) error
- func (v *Network) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Network) UnmarshalJSON(data []byte) error
- func (n *Network) ValidatePath() error
- type OnConflict
- type Opt
- type OutputCallback
- type PathRegistry
- type PathResolver
- type Pather
- type Plan
- func (p *Plan) BurnIt() error
- func (p *Plan) Execute() tfdiags.Diagnostics
- func (v Plan) MarshalEasyJSON(w *jwriter.Writer)
- func (v Plan) MarshalJSON() ([]byte, error)
- func (p *Plan) Orchestrator(v dag.Vertex) (d tfdiags.Diagnostics)
- func (p *Plan) Preflight() error
- func (p *Plan) RemoveRevisionFilesFromTeams() error
- func (p *Plan) SetupTasks() error
- func (v *Plan) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Plan) UnmarshalJSON(data []byte) error
- func (p *Plan) WriteRevisionFile(d Doer, status RevStatus) error
- type ProvisionStatus
- type ProvisionedHost
- func (p *ProvisionedHost) ActualPassword() string
- func (p *ProvisionedHost) Base() string
- func (p *ProvisionedHost) CreateConnection() *Connection
- func (p *ProvisionedHost) CreateProvisioningStep(pr Provisioner, offset int) *ProvisioningStep
- func (p *ProvisionedHost) CreateProvisioningSteps() error
- func (p *ProvisionedHost) Gather(g *Snapshot) error
- func (p *ProvisionedHost) GetCaller() Caller
- func (p *ProvisionedHost) GetOnConflict() OnConflict
- func (p *ProvisionedHost) Hash() uint64
- func (p *ProvisionedHost) LaforgeID() string
- func (v ProvisionedHost) MarshalEasyJSON(w *jwriter.Writer)
- func (v ProvisionedHost) MarshalJSON() ([]byte, error)
- func (p *ProvisionedHost) ParentLaforgeID() string
- func (p *ProvisionedHost) Path() string
- func (p *ProvisionedHost) SetCaller(ca Caller)
- func (p *ProvisionedHost) SetID() string
- func (p *ProvisionedHost) SetOnConflict(o OnConflict)
- func (p *ProvisionedHost) Swap(m Mergeable) error
- func (v *ProvisionedHost) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ProvisionedHost) UnmarshalJSON(data []byte) error
- func (p *ProvisionedHost) ValidatePath() error
- type ProvisionedNetwork
- func (p *ProvisionedNetwork) Base() string
- func (p *ProvisionedNetwork) CreateProvisionedHost(host *Host) *ProvisionedHost
- func (p *ProvisionedNetwork) CreateProvisionedHosts() error
- func (p *ProvisionedNetwork) Gather(g *Snapshot) error
- func (p *ProvisionedNetwork) GetCaller() Caller
- func (p *ProvisionedNetwork) GetOnConflict() OnConflict
- func (p *ProvisionedNetwork) Hash() uint64
- func (p *ProvisionedNetwork) LaforgeID() string
- func (v ProvisionedNetwork) MarshalEasyJSON(w *jwriter.Writer)
- func (v ProvisionedNetwork) MarshalJSON() ([]byte, error)
- func (p *ProvisionedNetwork) ParentLaforgeID() string
- func (p *ProvisionedNetwork) Path() string
- func (p *ProvisionedNetwork) SetCaller(ca Caller)
- func (p *ProvisionedNetwork) SetID() string
- func (p *ProvisionedNetwork) SetOnConflict(o OnConflict)
- func (p *ProvisionedNetwork) Swap(m Mergeable) error
- func (v *ProvisionedNetwork) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ProvisionedNetwork) UnmarshalJSON(data []byte) error
- func (p *ProvisionedNetwork) ValidatePath() error
- type Provisioner
- type ProvisioningStep
- func (p *ProvisioningStep) Base() string
- func (p *ProvisioningStep) Gather(g *Snapshot) error
- func (p *ProvisioningStep) GetCaller() Caller
- func (p *ProvisioningStep) GetOnConflict() OnConflict
- func (p *ProvisioningStep) Hash() uint64
- func (p *ProvisioningStep) LaforgeID() string
- func (v ProvisioningStep) MarshalEasyJSON(w *jwriter.Writer)
- func (v ProvisioningStep) MarshalJSON() ([]byte, error)
- func (p *ProvisioningStep) ParentLaforgeID() string
- func (p *ProvisioningStep) Path() string
- func (p *ProvisioningStep) SetCaller(ca Caller)
- func (p *ProvisioningStep) SetID() string
- func (p *ProvisioningStep) SetOnConflict(o OnConflict)
- func (p *ProvisioningStep) Swap(m Mergeable) error
- func (v *ProvisioningStep) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ProvisioningStep) UnmarshalJSON(data []byte) error
- func (p *ProvisioningStep) ValidatePath() error
- type RelateFunc
- type Remote
- type RemoteCommand
- type RemoteFile
- func (r *RemoteFile) AssetName() (string, error)
- func (r *RemoteFile) Base() string
- func (r *RemoteFile) CopyTo(dst string) error
- func (r *RemoteFile) Fullpath() string
- func (r *RemoteFile) Gather(g *Snapshot) error
- func (r *RemoteFile) GetCaller() Caller
- func (r *RemoteFile) GetOnConflict() OnConflict
- func (r *RemoteFile) Hash() uint64
- func (r *RemoteFile) Kind() string
- func (r *RemoteFile) LaforgeID() string
- func (r *RemoteFile) MD5Sum() (string, error)
- func (v RemoteFile) MarshalEasyJSON(w *jwriter.Writer)
- func (v RemoteFile) MarshalJSON() ([]byte, error)
- func (r *RemoteFile) ParentLaforgeID() string
- func (r *RemoteFile) Path() string
- func (r *RemoteFile) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error
- func (r *RemoteFile) ResourceHash() uint64
- func (r *RemoteFile) SetCaller(c Caller)
- func (r *RemoteFile) SetOnConflict(o OnConflict)
- func (r *RemoteFile) Swap(m Mergeable) error
- func (v *RemoteFile) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *RemoteFile) UnmarshalJSON(data []byte) error
- func (r *RemoteFile) ValidatePath() error
- type RemoteFileJob
- func (j *RemoteFileJob) CanProceed() error
- func (j *RemoteFileJob) CleanUp() error
- func (j *RemoteFileJob) Do() error
- func (j *RemoteFileJob) EnsureDependencies(l *Laforge) error
- func (j *RemoteFileJob) Finish() error
- func (v RemoteFileJob) MarshalEasyJSON(w *jwriter.Writer)
- func (v RemoteFileJob) MarshalJSON() ([]byte, error)
- func (v *RemoteFileJob) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *RemoteFileJob) UnmarshalJSON(data []byte) error
- type ResourceHasher
- type RevMod
- type RevStatus
- type Revision
- func (v Revision) MarshalEasyJSON(w *jwriter.Writer)
- func (v Revision) MarshalJSON() ([]byte, error)
- func (r *Revision) ToJSONString() string
- func (r *Revision) Touch() *Revision
- func (r *Revision) TouchWithID(s string) *Revision
- func (v *Revision) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Revision) UnmarshalJSON(data []byte) error
- type SSHAuthConfig
- func (s *SSHAuthConfig) Hash() uint64
- func (s *SSHAuthConfig) LoadIdentityFile(base *Laforge, pr *PathResolver, caller CallFile) error
- func (v SSHAuthConfig) MarshalEasyJSON(w *jwriter.Writer)
- func (v SSHAuthConfig) MarshalJSON() ([]byte, error)
- func (s *SSHAuthConfig) Protocol() string
- func (v *SSHAuthConfig) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *SSHAuthConfig) UnmarshalJSON(data []byte) error
- type SSHClient
- func (s *SSHClient) Connect() (err error)
- func (s *SSHClient) DeleteScriptV2(remotefile string) error
- func (s *SSHClient) Disconnect() error
- func (s *SSHClient) LaunchInteractiveShell() error
- func (s *SSHClient) Start(cmd *RemoteCommand) error
- func (s *SSHClient) Upload(path string, input io.Reader) error
- func (s *SSHClient) UploadDir(dst string, src string) error
- func (s *SSHClient) UploadFileV2(src, dst string) error
- func (s *SSHClient) UploadScript(path string, input io.Reader) error
- func (s *SSHClient) UploadScriptV2(src, dst string) error
- type Script
- func (s *Script) ArgString() string
- func (s *Script) Base() string
- func (s *Script) Fullpath() string
- func (s *Script) Gather(g *Snapshot) error
- func (s *Script) GetCaller() Caller
- func (s *Script) GetOnConflict() OnConflict
- func (s *Script) Hash() uint64
- func (s *Script) Kind() string
- func (s *Script) LaforgeID() string
- func (v Script) MarshalEasyJSON(w *jwriter.Writer)
- func (v Script) MarshalJSON() ([]byte, error)
- func (s *Script) ParentLaforgeID() string
- func (s *Script) Path() string
- func (s *Script) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error
- func (s *Script) ResourceHash() uint64
- func (s *Script) SetCaller(c Caller)
- func (s *Script) SetOnConflict(o OnConflict)
- func (s *Script) SourceBase() string
- func (s *Script) Swap(m Mergeable) error
- func (v *Script) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Script) UnmarshalJSON(data []byte) error
- func (s *Script) ValidatePath() error
- type ScriptJob
- func (j *ScriptJob) CanProceed() error
- func (j *ScriptJob) CleanUp() error
- func (j *ScriptJob) Do() error
- func (j *ScriptJob) EnsureDependencies(l *Laforge) error
- func (j *ScriptJob) Finish() error
- func (v ScriptJob) MarshalEasyJSON(w *jwriter.Writer)
- func (v ScriptJob) MarshalJSON() ([]byte, error)
- func (v *ScriptJob) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ScriptJob) UnmarshalJSON(data []byte) error
- type ShellConfig
- type Snapshot
- func (s *Snapshot) AddNodeV2(id string)
- func (s *Snapshot) AddObject(dep Dependency)
- func (s *Snapshot) AddRelationship(src Dependency, target Dependency)
- func (s *Snapshot) GetEdges() mapset.Set
- func (s *Snapshot) Hash() uint64
- func (v Snapshot) MarshalEasyJSON(w *jwriter.Writer)
- func (v Snapshot) MarshalJSON() ([]byte, error)
- func (s *Snapshot) PopulateGraph(end chan struct{}, fin chan struct{})
- func (s *Snapshot) RebuildGraph() error
- func (s *Snapshot) Relate(root Dependency, leafs ...Dependency) error
- func (s *Snapshot) RelateObjects(end chan struct{}, fin chan struct{})
- func (s *Snapshot) RelateV2(e Edge)
- func (s *Snapshot) StoreMetadata(end chan struct{}, fin chan struct{})
- func (v *Snapshot) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Snapshot) UnmarshalJSON(data []byte) error
- func (s *Snapshot) WalkEnvironment(e *Environment, wg *sync.WaitGroup)
- func (s *Snapshot) WalkHost(h *Host, wg *sync.WaitGroup)
- func (s *Snapshot) WalkProvisionedHost(ph *ProvisionedHost, wg *sync.WaitGroup)
- func (s *Snapshot) WalkTeam(t *Team, wg *sync.WaitGroup)
- type State
- func (s *State) CalculateDelta() (*Plan, error)
- func (s *State) CreateDBSchema() error
- func (s *State) GenerateCurrentRevs() error
- func (s *State) GenerateRevisionDelta() error
- func (s *State) InitializeEmptyPersistedSnapshot() error
- func (s *State) KnownRevHashes() uint64
- func (s *State) LoadSnapshotFromDB() (*Snapshot, error)
- func (s *State) LocateRevisions() error
- func (s *State) NewRevHashes() uint64
- func (s *State) Open(dbfile string) error
- func (s *State) PersistSnapshot(snap *Snapshot) error
- func (s *State) SetCurrent(snap *Snapshot)
- func (s *State) SnapshotsEqual() bool
- type StateContext
- type Status
- func (s *Status) CanProceed() bool
- func (s *Status) Current() ProvisionStatus
- func (s *Status) Hash() uint64
- func (v Status) MarshalEasyJSON(w *jwriter.Writer)
- func (v Status) MarshalJSON() ([]byte, error)
- func (v *Status) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Status) UnmarshalJSON(data []byte) error
- type Team
- func (t *Team) Associate(g *Snapshot) error
- func (t *Team) Base() string
- func (t *Team) CreateProvisionResources() error
- func (t *Team) CreateProvisionedNetwork(net *Network) *ProvisionedNetwork
- func (t *Team) CreateRunner() *runner.Runner
- func (t *Team) Gather(g *Snapshot) error
- func (t *Team) GetCaller() Caller
- func (t *Team) GetOnConflict() OnConflict
- func (t *Team) Hash() uint64
- func (t *Team) LaforgeID() string
- func (t *Team) LoadFileDeps(base *Laforge, pr *PathResolver, caller CallFile) error
- func (t *Team) LocateProvisionedHost(netid, hostid string) (*ProvisionedHost, error)
- func (v Team) MarshalEasyJSON(w *jwriter.Writer)
- func (v Team) MarshalJSON() ([]byte, error)
- func (t *Team) ParentLaforgeID() string
- func (t *Team) Path() string
- func (t *Team) RunLocalCommand(command string, args []string, wg *sync.WaitGroup, errChan chan error)
- func (t *Team) RunTerraformCommand(args []string, wg *sync.WaitGroup, errChan chan error)
- func (t *Team) RunTerraformSequence(cmds []string, wg *sync.WaitGroup, errChan chan error)
- func (t *Team) SetCaller(ca Caller)
- func (t *Team) SetID() string
- func (t *Team) SetOnConflict(o OnConflict)
- func (t *Team) Swap(m Mergeable) error
- func (t *Team) TerraformInit() error
- func (v *Team) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Team) UnmarshalJSON(data []byte) error
- func (t *Team) ValidatePath() error
- type TerraformJob
- func (j *TerraformJob) CanProceed() error
- func (j *TerraformJob) CleanUp() error
- func (j *TerraformJob) Do() error
- func (j *TerraformJob) EnsureDependencies(l *Laforge) error
- func (j *TerraformJob) Finish() error
- func (v TerraformJob) MarshalEasyJSON(w *jwriter.Writer)
- func (v TerraformJob) MarshalJSON() ([]byte, error)
- func (v *TerraformJob) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *TerraformJob) UnmarshalJSON(data []byte) error
- type User
- type WinRMAuthConfig
- func (w *WinRMAuthConfig) Hash() uint64
- func (w *WinRMAuthConfig) LoadCAFile(base *Laforge, pr *PathResolver, caller CallFile) error
- func (w *WinRMAuthConfig) LoadCertFile(base *Laforge, pr *PathResolver, caller CallFile) error
- func (w *WinRMAuthConfig) LoadKeyFile(base *Laforge, pr *PathResolver, caller CallFile) error
- func (v WinRMAuthConfig) MarshalEasyJSON(w *jwriter.Writer)
- func (v WinRMAuthConfig) MarshalJSON() ([]byte, error)
- func (w *WinRMAuthConfig) Protocol() string
- func (w *WinRMAuthConfig) ToUploadConfig() (string, winrmcp.Config)
- func (v *WinRMAuthConfig) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *WinRMAuthConfig) UnmarshalJSON(data []byte) error
- type WinRMClient
- func (w *WinRMClient) ExecuteNonInteractive(cmd *RemoteCommand) error
- func (w *WinRMClient) Kind() string
- func (w *WinRMClient) LaunchInteractiveShell() error
- func (w *WinRMClient) SetConfig(c *WinRMAuthConfig) error
- func (w *WinRMClient) SetIO(stdout io.Writer, stderr io.Writer, stdin io.Reader) error
Constants ¶
const ( // ZeroDifficulty is a zero difficulty finding ZeroDifficulty FindingDifficulty = iota // NoviceDifficulty is a novice difficulty finding NoviceDifficulty // AdvancedDifficulty is an advanced difficulty finding AdvancedDifficulty // ExpertDifficulty is an expert difficulty finding ExpertDifficulty // ZeroSeverity is a zero severity finding ZeroSeverity FindingSeverity = iota // LowSeverity is a low severity finding LowSeverity // MediumSeverity is a medium severity finding MediumSeverity // HighSeverity is a high severity finding HighSeverity // CriticalSeverity is a critical severity finding CriticalSeverity )
const ( // DefaultPathToLocalStateFile is the path to a local copy of the state file for a local state DefaultPathToLocalStateFile = "terraform.tfstate" // DefaultPathToRemoteStateFile is the path to a local copy of the state file for a remote state DefaultPathToRemoteStateFile = ".terraform/terraform.tfstate" )
const ( // RevStatusUnknown is when the resource can be assumed to be destoryed or MIA RevStatusUnknown RevStatus = `UNKNOWN` // RevStatusStale is when the resource is no longer used by outside systems (non-existent terraform host) RevStatusStale RevStatus = `STALE` // RevStatusActive is when the resource has actively been created successfully RevStatusActive RevStatus = `ACTIVE` // RevStatusPlanned is when the resource doesnt require a config change, but has not been created yet. RevStatusPlanned RevStatus = `PLANNED` // RevStatusFailed is when the resource was attempted to have been created, but failed in the process. RevStatusFailed RevStatus = `FAILED` // RevModTouch describes a revision that needs to be updated on disk RevModTouch RevMod = `TOUCH` // RevModDelete describes a revision that needs to be deleted off disk RevModDelete RevMod = `DELETE` // RevModCreate describes a revision that needs to be created on disk RevModCreate RevMod = `CREATE` )
const (
// DBKeySnapshot is the database key for persisting the snapshot in our local filesystem
DBKeySnapshot = `/snapshot`
)
const (
// DefaultShebang is added at the top of a SSH script file
DefaultShebang = "#!/bin/bash\n"
)
const ( // NullIP is represents an IP that is unknown to our systems NullIP string = `0.0.0.0` )
Variables ¶
var ( // ErrContextViolation is an error thrown when an action is taken that attempts to exceed the current state's ScopeContext ErrContextViolation = errors.New("context scope violation") // ErrAbsPathDeclNotExist is thrown when an absolute path is listed in a file yet it cannot be resolved on the local system ErrAbsPathDeclNotExist = errors.New("absolute path was not found on local system") // ErrInvalidEnvName is thrown when an environment name does not meet specified regulations around environment naming conventions ErrInvalidEnvName = errors.New("environment names can only contain lowercase alphanumeric and dash characters (a valid subdomain)") // ErrDeprecatedID is thrown when an object using a deprecated ID format is loaded ErrDeprecatedID = errors.New("the object is using a deprecated ID format and should be updated") // ErrInvalidIDFormat is thrown when an object using an invalid ID format is loaded ErrInvalidIDFormat = errors.New("object ID does not meet valid ID requirements") // ValidIDRegexp is the format for the new object ID schema. ValidIDRegexp = regexp.MustCompile(`\A[a-z0-9][a-z0-9\-]{1,34}[a-z0-9]\z`) // ValidOldIDRegexp is the old ID schema that allowed additional characters (periods and underscores) // and did not validate minimum or maximum length. These formats often incurred incompatabilities with // existing systems and will be deprecated. ValidOldIDRegexp = regexp.MustCompile(`\A[a-zA-Z0-9][a-zA-Z0-9\-\_\.]{2,34}[a-zA-Z0-9]\z`) )
var ( // ErrNoGlobalConfig is thrown when there is no global configuration for a user ErrNoGlobalConfig = errors.New("no global configuration exists") // ErrNoConfigRootReached is thrown when the entire filesystem has been traversed to the root without locating a valid config file ErrNoConfigRootReached = errors.New("no valid config file was located between current directory and the filesystem root") )
var ( // ErrInvalidDifficulty is thrown if the difficulty is invalid ErrInvalidDifficulty = errors.New("difficulty does not fall within valid range of 0-3") // ErrInvalidSeverity is thrown if the difficulty is invalid ErrInvalidSeverity = errors.New("severity does not fall within valid range of 0-3") )
var ( // ErrPathEndsInSlash is thrown when a path ends in a trailing slash ErrPathEndsInSlash = errors.New("path ends in a trailing slash") // ErrPathContainsInvalidChars is thrown when a path contains invalid characters ErrPathContainsInvalidChars = errors.New("path contains invalid characters") // ErrPathContainsDuplicateSlash is thrown when a path contains two consecutive slashes ErrPathContainsDuplicateSlash = errors.New("path contains consecutive slash characters") )
var ( // PrivateIPOutputRegexp matches outputs for private IP addresses PrivateIPOutputRegexp = regexp.MustCompile(`\A(\w+)\.private_ip\z`) // PublicIPOutputRegexp matches outputs for private IP addresses PublicIPOutputRegexp = regexp.MustCompile(`\A(\w+)\.public_ip\z`) )
var ( // ErrInvalidShellConfigType is thrown when an invalid shellconfig type is passed into a connection handler ErrInvalidShellConfigType = errors.New("invalid shell configuration provided to connection handler") )
var ( // ErrSnapshotsMatch is thrown when two snapshots are functionally the same during delta calculation ErrSnapshotsMatch = errors.New("snapshots reflected the same state") )
var ( // ErrSwapTypeMismatch is thrown when a Swap() function on the Mergeable interface cannot find it's native type ErrSwapTypeMismatch = errors.New("mergeable swap() call failed due to delta type mismatch") )
var ( // ExampleObjects holds a map of example objects ExampleObjects = map[string]interface{}{ "ami": defaultAMI(), "command": defaultCommand(), "dns_record": defaultDNSRecord(), "identity": defaultIdentity(), "network": defaultNetwork(), "remote_file": defaultRemoteFile(), "script": defaultScript(), "host": defaultHost(), "environment": defaultEnvironment(), } )
var TemplateFuncLib = template.FuncMap{ "hclstring": QuotedHCLString, "N": iter.N, "UnsafeAtoi": UnsafeStringAsInt, "Decr": Decr, }
TemplateFuncLib is a standard template library of functions
var ( // ValidEnvNameRegexp is a regular expression that can be used to validate environment names ValidEnvNameRegexp = regexp.MustCompile(`\A[a-z0-9][a-z0-9\-]*?[a-z0-9]\z`) )
Functions ¶
func BuildDirFromEnvRoot ¶
BuildDirFromEnvRoot is a convenience function to get a prebuilt filepath to the build directory for an env root.
func CalculateTerraformNeeds ¶
CalculateTerraformNeeds attempts to determine what terraform steps must happen first for a given plan.
func ConnectFunc ¶
ConnectFunc is a convenience method for returning a function that just uses net.Dial to communicate with the remote end that is suitable for use with the SSH communicator configuration.
func CreateGlobalConfig ¶
CreateGlobalConfig writes a User configuration to ~/.laforge/global.laforge
func DependencyCost ¶
func DependencyCost(d Dependency) int64
DependencyCost returns a pre-specified cost for paths within the graph traversal
func DependencyType ¶
func DependencyType(d Dependency) string
DependencyType is used to return a string representation of the ObjectType of a dependency
func ExampleObjectByName ¶
ExampleObjectByName retrieves a templated example object of type (name)
func FileGlobResolver ¶
FileGlobResolver is a modified FileResolver in the HCLv2 include extension that accounts for globbed includes:
include {
path = "./foo/*.laforge"
}
func FindTerraformExecutable ¶
FindTerraformExecutable attempts to find the terraform executable in the given path
func GetEmptyObjByName ¶
GetEmptyObjByName returns a pointer to an initialized, but empty object of the specified type (camel case).
func GetTeamIDFromPath ¶
GetTeamIDFromPath attempts to resolve the team's unique ID from the provided ID
func GlobalConfigDir ¶
GlobalConfigDir attempts to retrieve the user's global configuration directory (dotfile in $HOME)
func HCLBytesToObject ¶
HCLBytesToObject renders bytes into an object of a specific type
func HashConfigMap ¶
HashConfigMap is used to hash the configuration map in a deterministic order
func InitializeBuildDirectory ¶
InitializeBuildDirectory creates a build directory structure and writes the build.db as a precursor to builder's taking over.
func IsGlobalType ¶
IsGlobalType is a helper function that attempts to determine if the specified path is of a global type
func LoadHCLFromFile ¶
LoadHCLFromFile attempts to load and parse an HCL file with a filepath location
func LocateBaseConfig ¶
LocateBaseConfig attempts to locate a valid base.laforge in the current directory or one of it's parents
func LocateBuildConfig ¶
LocateBuildConfig attempts to locate a valid env.laforge in the current directory or it's parents
func LocateEnvConfig ¶
LocateEnvConfig attempts to locate a valid env.laforge in the current directory or it's parents
func LocateGlobalConfig ¶
LocateGlobalConfig attempts to detect a global configuration in the GlobalConfigDir
func LocateTeamConfig ¶
LocateTeamConfig attempts to locate a valid team.laforge in the current directory or it's parents
func NewMergeConflict ¶
func NewMergeConflict(
base, layer interface{},
baseid, layerid string,
baseCaller, layerCaller CallFile,
) error
NewMergeConflict is a helper function that creates a nicely formatted error when a merge conflict fails during an object differential update.
func OutdatedID ¶
OutdatedID checks to determine if the ID is in an outdated format.
func PathExists ¶
PathExists is a convenience function to determine if a path exists at it's location
func QuotedHCLString ¶
QuotedHCLString is a template function to render safe HCLv2 strings
func RenderHCLv2Object ¶
RenderHCLv2Object is a generic templating function for HCLv2 compatible types
func SSHClientConfig ¶
func SSHClientConfig(sshconf *SSHAuthConfig, overrideKey string) (*ssh.ClientConfig, error)
SSHClientConfig attempts to create an x/ssh client configuration for connection authentication
func StatusMap ¶
func StatusMap(curr StateContext) string
StatusMap gives a visual representation of the current state context
func TouchGitKeep ¶
TouchGitKeep is a helper function to touch a .gitkeep file within a given directory.
func TraverseUpForFile ¶
TraverseUpForFile looks for a file by the given filename upwards in the file structure
func UnsafeStringAsInt ¶
UnsafeStringAsInt is a template helper function that will return -1 if it cannot convert the string to an integer.
func UserWizard ¶
func UserWizard() error
UserWizard runs an interactive prompt to get the user's information.
func ValidEnvName ¶
ValidEnvName is a helper function to determine if a supplied name is a valid environment name
func ValidateGenericPath ¶
ValidateGenericPath covers basic rules validating a path generically for invalid schema
Types ¶
type AMI ¶
type AMI struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
Description string `hcl:"description,attr" json:"description,omitempty"`
Provider string `hcl:"provider,attr" json:"provider,omitempty"`
Username string `hcl:"username,attr" json:"username,omitempty"`
Vars map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
}
AMI represents a configurable object for defining custom AMIs in cloud infrastructure
func (AMI) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (AMI) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*AMI) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AMI) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Build ¶
type Build struct {
ID string `hcl:"id,label" json:"id,omitempty"`
TeamCount int `hcl:"team_count,attr" json:"team_count,omitempty"`
Config map[string]string `hcl:"config,attr" json:"config,omitempty"`
Tags map[string]string `hcl:"tags,attr" json:"tags,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
Revision int64 `hcl:"revision,attr" json:"revision,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
PathFromBase string `hcl:"path_from_base,optional" json:"path_from_base,omitempty"`
Environment *Environment `json:"-"`
Competition *Competition `json:"-"`
RelEnvPath string `json:"-"`
Dir string `json:"-"`
Caller Caller `json:"-"`
LocalDBFile *LocalFileRef `json:"-"`
Teams map[string]*Team `json:"-"`
}
Build represents the output of a laforge build
func (*Build) AssetForTeam ¶
AssetForTeam is a template helper function that returns the location of team specific assets
func (*Build) CreateTeam ¶
CreateTeam creates a new team of a given team index for the build.
func (*Build) CreateTeams ¶
CreateTeams enumerates the build's team count and generates children team objects
func (*Build) GetOnConflict ¶
func (b *Build) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (Build) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Build) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Build) ParentLaforgeID ¶
ParentLaforgeID returns the build's parent environment ID
func (*Build) RelAssetForTeam ¶
RelAssetForTeam is a template helper function that returns the relative location of team specific assets
func (*Build) SetOnConflict ¶
func (b *Build) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Build) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Build) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Build) ValidatePath ¶
ValidatePath implements the Pather interface
type CallFile ¶
CallFile is a debug type for tracking any file a configuration object was referenced in
type Caller ¶
type Caller []CallFile
Caller represents a call chain in FIFO order of all a configuration object's CallFiles
type ChecksumList ¶
type ChecksumList []uint64
ChecksumList is a type alias for a set of computed hashes
func (ChecksumList) Less ¶
func (c ChecksumList) Less(i, j int) bool
Less implements the sort interface
func (ChecksumList) MarshalEasyJSON ¶
func (v ChecksumList) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ChecksumList) MarshalJSON ¶
func (v ChecksumList) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ChecksumList) UnmarshalEasyJSON ¶
func (v *ChecksumList) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ChecksumList) UnmarshalJSON ¶
func (v *ChecksumList) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Command ¶
type Command struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
Description string `hcl:"description,attr" json:"description,omitempty"`
Program string `hcl:"program,attr" json:"program,omitempty"`
Args []string `hcl:"args,attr" json:"args,omitempty"`
IgnoreErrors bool `hcl:"ignore_errors,attr" json:"ignore_errors,omitempty"`
Cooldown int `hcl:"cooldown,attr" json:"cooldown,omitempty"`
IO *IO `hcl:"io,block" json:"io,omitempty"`
Disabled bool `hcl:"disabled,attr" json:"disabled,omitempty"`
Vars map[string]string `hcl:"vars,attr" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,attr" json:"tags,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
Caller Caller `json:"-"`
}
Command represents an executable command that can be defined as part of a host configuration step
func (*Command) CommandString ¶
CommandString is a template helper function to embed commands into the output
func (*Command) GetOnConflict ¶
func (c *Command) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (Command) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Command) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Command) ParentLaforgeID ¶
ParentLaforgeID implements the Dependency interface
func (*Command) SetOnConflict ¶
func (c *Command) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Command) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Command) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Command) ValidatePath ¶
ValidatePath implements the Pather interface
type CommandJob ¶
type CommandJob struct {
GenericJob
Command []string `json:"command"`
GoodOutputRegexp string `json:"good_output_regexp"`
Target *ProvisionedHost `json:"-"`
}
CommandJob attempts to execute remote commands on the system easyjson:json
func (*CommandJob) CanProceed ¶
func (j *CommandJob) CanProceed() error
CanProceed implements the Doer interface
func (*CommandJob) CleanUp ¶
func (j *CommandJob) CleanUp() error
CleanUp implements the Doer interface
func (*CommandJob) EnsureDependencies ¶
func (j *CommandJob) EnsureDependencies(l *Laforge) error
EnsureDependencies implements the Doer interface
func (*CommandJob) Finish ¶
func (j *CommandJob) Finish() error
Finish implements the Doer interface
func (CommandJob) MarshalEasyJSON ¶
func (v CommandJob) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (CommandJob) MarshalJSON ¶
func (v CommandJob) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*CommandJob) UnmarshalEasyJSON ¶
func (v *CommandJob) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*CommandJob) UnmarshalJSON ¶
func (v *CommandJob) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Competition ¶
type Competition struct {
ID string `hcl:"id,label" json:"id,omitempty"`
BaseDir string `hcl:"base_dir,optional" json:"base_dir,omitempty"`
RootPassword string `hcl:"root_password,attr" json:"root_password,omitempty"`
DNS *DNS `hcl:"dns,block" json:"dns,omitempty"`
Remote *Remote `hcl:"remote,block" json:"remote,omitempty"`
Config map[string]string `hcl:"config,optional" json:"config,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Caller Caller `json:"-"`
}
Competition is a configurable type that holds competition wide settings
func (*Competition) GetCaller ¶
func (c *Competition) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*Competition) GetOnConflict ¶
func (c *Competition) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*Competition) LaforgeID ¶
func (c *Competition) LaforgeID() string
LaforgeID implements the Mergeable interface
func (Competition) MarshalEasyJSON ¶
func (v Competition) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Competition) MarshalJSON ¶
func (v Competition) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Competition) PasswordForHost ¶
func (c *Competition) PasswordForHost(h *Host) string
PasswordForHost is a template helper function to allow a overridden password to be retrieved
func (*Competition) SetCaller ¶
func (c *Competition) SetCaller(ca Caller)
SetCaller implements the Mergeable interface
func (*Competition) SetOnConflict ¶
func (c *Competition) SetOnConflict(oc OnConflict)
SetOnConflict implements the Mergeable interface
func (*Competition) Swap ¶
func (c *Competition) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*Competition) UnmarshalEasyJSON ¶
func (v *Competition) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Competition) UnmarshalJSON ¶
func (v *Competition) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*Competition) ValidatePath ¶
func (c *Competition) ValidatePath() error
ValidatePath implements the Pather interface
type Connection ¶
type Connection struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Active bool `hcl:"active,attr" json:"active,omitempty"`
LocalAddr string `hcl:"local_addr,attr" json:"local_addr,omitempty"`
RemoteAddr string `hcl:"remote_addr,attr" json:"remote_addr,omitempty"`
ResourceName string `hcl:"resource_name,attr" json:"resource_name,omitempty"`
SSHAuthConfig *SSHAuthConfig `hcl:"ssh,block" json:"ssh,omitempty"`
WinRMAuthConfig *WinRMAuthConfig `hcl:"winrm,block" json:"winrm,omitempty"`
Revision int64 `hcl:"revision,optional" json:"revision,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Competition *Competition `json:"-"`
Environment *Environment `json:"-"`
Build *Build `json:"-"`
Team *Team `json:"-"`
Network *Network `json:"-"`
Host *Host `json:"-"`
ProvisionedHost *ProvisionedHost `json:"-"`
ProvisionedNetwork *ProvisionedNetwork `json:"-"`
Caller Caller `json:"-"`
}
Connection defines an access method provisioned host within a team's environment
func (*Connection) DeleteScriptSFTP ¶
func (c *Connection) DeleteScriptSFTP(remotefile string) error
DeleteScriptSFTP uses the really nice golang SFTP client to zero and delete remote files
func (*Connection) ExecuteCommand ¶
func (c *Connection) ExecuteCommand(cmd *RemoteCommand) error
ExecuteCommand is the generic interface for a connection to execute a command on the remote system
func (*Connection) ExecuteCommandSSH ¶
func (c *Connection) ExecuteCommandSSH(cmd *RemoteCommand) error
ExecuteCommandSSH executes a remote command over SSH
func (*Connection) ExecuteCommandWinRM ¶
func (c *Connection) ExecuteCommandWinRM(cmd *RemoteCommand) error
ExecuteCommandWinRM executes a remote command over WinRM
func (*Connection) Gather ¶
func (c *Connection) Gather(s *Snapshot) error
Gather implements the dependency interface
func (*Connection) GetCaller ¶
func (c *Connection) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*Connection) GetOnConflict ¶
func (c *Connection) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*Connection) InteractiveSSH ¶
func (c *Connection) InteractiveSSH() error
InteractiveSSH launches an interactive shell over SSH
func (*Connection) InteractiveWinRM ¶
func (c *Connection) InteractiveWinRM() error
InteractiveWinRM launches an interactive shell over WinRM
func (*Connection) IsSSH ¶
func (c *Connection) IsSSH() bool
IsSSH is a convenience method for checking if the provisioned host is setup for remote SSH
func (*Connection) IsWinRM ¶
func (c *Connection) IsWinRM() bool
IsWinRM is a convenience method for checking if the provisioned host is setup for remote WinRM
func (*Connection) LaforgeID ¶
func (c *Connection) LaforgeID() string
LaforgeID implements the Mergeable interface
func (Connection) MarshalEasyJSON ¶
func (v Connection) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Connection) MarshalJSON ¶
func (v Connection) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Connection) ParentLaforgeID ¶
func (c *Connection) ParentLaforgeID() string
ParentLaforgeID returns connections parent provisioned host
func (*Connection) RemoteShell ¶
func (c *Connection) RemoteShell() error
RemoteShell connects your local console to a remote provisioned host
func (*Connection) SetCaller ¶
func (c *Connection) SetCaller(ca Caller)
SetCaller implements the Mergeable interface
func (*Connection) SetID ¶
func (c *Connection) SetID() string
SetID increments the revision and sets the ID if needed
func (*Connection) SetOnConflict ¶
func (c *Connection) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Connection) Swap ¶
func (c *Connection) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*Connection) UnmarshalEasyJSON ¶
func (v *Connection) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Connection) UnmarshalJSON ¶
func (v *Connection) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*Connection) Upload ¶
func (c *Connection) Upload(src, dst string) error
Upload uploads a src file/dir to a dst file/dir on the provisioned host
func (*Connection) UploadExecuteAndDelete ¶
func (c *Connection) UploadExecuteAndDelete(scriptsrc string, tmpname string, logdir string) error
UploadExecuteAndDelete is a helper function to chain together a common pattern of execution
func (*Connection) UploadSCP ¶
func (c *Connection) UploadSCP(src, dst string) error
UploadSCP uses scp to upload src to dst on the provisioned host
func (*Connection) UploadSFTP ¶
func (c *Connection) UploadSFTP(src, dst string) error
UploadSFTP uses the really nice golang SFTP client to upload remote files
func (*Connection) UploadScriptSFTP ¶
func (c *Connection) UploadScriptSFTP(src, dst string) error
UploadScriptSFTP uses the really nice golang SFTP client to upload remote files
func (*Connection) UploadWinRM ¶
func (c *Connection) UploadWinRM(src, dst string) error
UploadWinRM uses WinRM to upload src to dst on the provisioned host
func (*Connection) ValidatePath ¶
func (c *Connection) ValidatePath() error
ValidatePath implements the Pather interface
type DNS ¶
type DNS struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Type string `hcl:"type,attr" json:"type,omitempty"`
RootDomain string `hcl:"root_domain,attr" json:"root_domain,omitempty"`
DNSServers []string `hcl:"dns_servers,attr" json:"dns_servers,omitempty"`
NTPServers []string `hcl:"ntp_servers,optional" json:"ntp_servers,omitempty"`
Config map[string]string `hcl:"config,optional" json:"config,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Caller Caller `json:"-"`
}
DNS represents a configurable type for the creation of competition DNS infrastructure
func (*DNS) GetOnConflict ¶
func (d *DNS) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (DNS) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (DNS) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*DNS) SetOnConflict ¶
func (d *DNS) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*DNS) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DNS) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type DNSRecord ¶
type DNSRecord struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
Values []string `hcl:"values,optional" json:"values,omitempty"`
Type string `hcl:"type,attr" json:"type,omitempty"`
Zone string `hcl:"zone,attr" json:"zone,omitempty"`
Vars map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
Disabled bool `hcl:"disabled,optional" json:"disabled,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Caller Caller `json:"-"`
}
DNSRecord is a configurable type for defining DNS entries related to this host in the core DNS infrastructure (if enabled)
func (*DNSRecord) GetOnConflict ¶
func (r *DNSRecord) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*DNSRecord) Inherited ¶
Inherited is a boolean condition that is triggered when a DNS record is not statically defined
func (DNSRecord) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (DNSRecord) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*DNSRecord) ParentLaforgeID ¶
ParentLaforgeID implements the Dependency interface
func (*DNSRecord) SetOnConflict ¶
func (r *DNSRecord) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*DNSRecord) SetValue ¶
SetValue is an override which allows you to set the value of a DNS record during a template run
func (*DNSRecord) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DNSRecord) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*DNSRecord) ValidatePath ¶
ValidatePath implements the Pather interface
type DNSRecordJob ¶
type DNSRecordJob struct {
GenericJob
Target *ProvisioningStep `json:"-"`
DNSRecord *DNSRecord `json:"-"`
}
DNSRecordJob attempts to set a DNS record via NSUpdate easyjson:json
func (*DNSRecordJob) CanProceed ¶
func (j *DNSRecordJob) CanProceed() error
CanProceed implements the Doer interface
func (*DNSRecordJob) CleanUp ¶
func (j *DNSRecordJob) CleanUp() error
CleanUp implements the Doer interface
func (*DNSRecordJob) EnsureDependencies ¶
func (j *DNSRecordJob) EnsureDependencies(l *Laforge) error
EnsureDependencies implements the Doer interface
func (*DNSRecordJob) Finish ¶
func (j *DNSRecordJob) Finish() error
Finish implements the Doer interface
func (DNSRecordJob) MarshalEasyJSON ¶
func (v DNSRecordJob) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DNSRecordJob) MarshalJSON ¶
func (v DNSRecordJob) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DNSRecordJob) UnmarshalEasyJSON ¶
func (v *DNSRecordJob) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DNSRecordJob) UnmarshalJSON ¶
func (v *DNSRecordJob) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Dependency ¶
type Dependency interface {
Pather
graph.Hasher
ParentLaforgeID() string
Gather(g *Snapshot) error
}
Dependency is an interface to define a laforge object that can be represented on the graph
type DependencyList ¶
type DependencyList []int
DependencyList is a helper type alias to handle topological sorting of laforge state elements
type Disk ¶
type Disk struct {
Size int `cty:"size" hcl:"size,attr" json:"size,omitempty"`
}
Disk is a configurable type for setting the root volume's disk size in GB
func (Disk) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Disk) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Disk) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Disk) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Doer ¶
type Doer interface {
graph.Hasher
GetTargetID() string
CanProceed() error
EnsureDependencies(l *Laforge) error
Do() error
CleanUp() error
Finish() error
SetTimeout(t int)
GetMetadata() *Metadata
SetStatus(s JobStatus)
SetPlan(p *Plan)
SetBase(l *Laforge)
CurrentStatus() JobStatus
}
Doer is an interface to describe types that may be executed in the flow
type Edge ¶
Edge is a type to store relationship information in the graph easyjson:json
func CreateEdge ¶
func CreateEdge(src Dependency, target Dependency) Edge
CreateEdge returns an edge creation data structure
func (Edge) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Edge) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Edge) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Edge) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Environment ¶
type Environment struct {
ID string `hcl:"id,label" json:"id,omitempty"`
CompetitionID string `hcl:"competition_id,attr" json:"competition_id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
Description string `hcl:"description,attr" json:"description,omitempty"`
Builder string `hcl:"builder,attr" json:"builder,omitempty"`
TeamCount int `hcl:"team_count,attr" json:"team_count,omitempty"`
AdminCIDRs []string `hcl:"admin_ranges,attr" json:"admin_ranges,omitempty"`
Config map[string]string `hcl:"config,optional" json:"config,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
Networks []*IncludedNetwork `hcl:"included_network,block" json:"included_networks,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
BaseDir string `hcl:"base_dir,optional" json:"base_dir,omitempty"`
Revision int64 `hcl:"revision,optional" json:"revision,omitempty"`
Build *Build `json:"-"`
IncludedNetworks map[string]*Network `json:"-"`
IncludedHosts map[string]*Host `json:"-"`
HostByNetwork map[string][]*Host `json:"-"`
Teams map[string]*Team `json:"-"`
Caller Caller `json:"-"`
Competition *Competition `json:"-"`
}
Environment represents the basic configurable type for a Laforge environment container
func (*Environment) CreateBuild ¶
func (e *Environment) CreateBuild() *Build
CreateBuild creates a fresh build object that is a child of the environment e.
func (*Environment) Gather ¶
func (e *Environment) Gather(g *Snapshot) error
Gather implements the Dependency interface
func (*Environment) GetCaller ¶
func (e *Environment) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*Environment) GetOnConflict ¶
func (e *Environment) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*Environment) LaforgeID ¶
func (e *Environment) LaforgeID() string
LaforgeID implements the Mergeable interface
func (Environment) MarshalEasyJSON ¶
func (v Environment) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Environment) MarshalJSON ¶
func (v Environment) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Environment) ParentLaforgeID ¶
func (e *Environment) ParentLaforgeID() string
ParentLaforgeID returns the Team's parent build ID
func (*Environment) ResolveIncludedNetworks ¶
func (e *Environment) ResolveIncludedNetworks(base *Laforge) error
ResolveIncludedNetworks walks the included_networks and included_hosts within the environment configuration ensuring that they can be located in the base laforge namespace.
func (*Environment) SetCaller ¶
func (e *Environment) SetCaller(c Caller)
SetCaller implements the Mergeable interface
func (*Environment) SetOnConflict ¶
func (e *Environment) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Environment) Swap ¶
func (e *Environment) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*Environment) UnmarshalEasyJSON ¶
func (v *Environment) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Environment) UnmarshalJSON ¶
func (v *Environment) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*Environment) ValidatePath ¶
func (e *Environment) ValidatePath() error
ValidatePath implements the Pather interface
type ExitError ¶
ExitError is returned by Wait to indicate and error executing the remote command, or a non-zero exit status.
type Finding ¶
type Finding struct {
Name string `hcl:"name,attr" json:"name,omitempty"`
Description string `hcl:"description,optional" json:"description,omitempty"`
Severity FindingSeverity `hcl:"severity,attr" json:"severity,omitempty"`
Difficulty FindingDifficulty `hcl:"difficulty,attr" json:"difficulty,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
Tags []string `hcl:"tags,optional" json:"tags,omitempty"`
Provisioner Provisioner `json:"-"`
Host *Host `json:"-"`
}
Finding represents a finding to be aggregated for scoring inside a laforge scenario
func (Finding) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Finding) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Finding) TotalScore ¶
TotalScore returns the total score applicable to a Finding
func (*Finding) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Finding) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type FindingDifficulty ¶
type FindingDifficulty int
FindingDifficulty is a type alias to the level of difficulty the finding exists as
func (FindingDifficulty) String ¶
func (f FindingDifficulty) String() string
String implements the stringer interface
type FindingSeverity ¶
type FindingSeverity int
FindingSeverity is a type alias to the level of severity the finding exists as
func (FindingSeverity) String ¶
func (f FindingSeverity) String() string
String implements the stringer interface
type GenericJob ¶
type GenericJob struct {
JobID string `json:"job_id"`
Plan *Plan `json:"-"`
Base *Laforge `json:"-"`
Offset int `json:"offset"`
Timeout int `json:"timeout"`
JobType string `json:"job_type"`
Metadata *Metadata `json:"-"`
MetadataID string `json:"metadata_id"`
Status JobStatus `json:"status"`
CreatedAt time.Time `json:"created_at,omitempty"`
StartedAt time.Time `json:"started_at,omitempty"`
EndedAt time.Time `json:"ended_at,omitempty"`
}
GenericJob is an embeddable type for standardizing laforge jobs easyjson:json
func (*GenericJob) CurrentStatus ¶
func (j *GenericJob) CurrentStatus() JobStatus
CurrentStatus implements the Doer interface
func (*GenericJob) GetID ¶
func (j *GenericJob) GetID() string
GetID implements the Relationship interface
func (*GenericJob) GetMetadata ¶
func (j *GenericJob) GetMetadata() *Metadata
GetMetadata implements the Doer interface
func (*GenericJob) GetTargetID ¶
func (j *GenericJob) GetTargetID() string
GetTargetID implements the Doer interface
func (GenericJob) MarshalEasyJSON ¶
func (v GenericJob) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (GenericJob) MarshalJSON ¶
func (v GenericJob) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*GenericJob) SetBase ¶
func (j *GenericJob) SetBase(l *Laforge)
SetBase implements the Doer interface
func (*GenericJob) SetPlan ¶
func (j *GenericJob) SetPlan(p *Plan)
SetPlan implements the Doer interface
func (*GenericJob) SetStatus ¶
func (j *GenericJob) SetStatus(s JobStatus)
SetStatus implements the Doer interface
func (*GenericJob) SetTimeout ¶
func (j *GenericJob) SetTimeout(t int)
SetTimeout implements the Doer interface
func (*GenericJob) UnmarshalEasyJSON ¶
func (v *GenericJob) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*GenericJob) UnmarshalJSON ¶
func (v *GenericJob) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Host ¶
type Host struct {
ID string `cty:"id" hcl:"id,label" json:"id,omitempty"`
Hostname string `cty:"hostname" hcl:"hostname,attr" json:"hostname,omitempty"`
Description string `cty:"description" hcl:"description,optional" json:"description,omitempty"`
OS string `cty:"os" hcl:"os,attr" json:"os,omitempty"`
AMI string `cty:"ami" hcl:"ami,optional" json:"ami,omitempty"`
LastOctet int `cty:"last_octet" hcl:"last_octet,attr" json:"last_octet,omitempty"`
InstanceSize string `cty:"instance_size" hcl:"instance_size,attr" json:"instance_size,omitempty"`
Disk Disk `cty:"disk" hcl:"disk,block" json:"disk,omitempty"`
ProvisionSteps []string `cty:"provision_steps" hcl:"provision_steps,optional" json:"provision_steps,omitempty"`
ExposedTCPPorts []string `cty:"exposed_tcp_ports" hcl:"exposed_tcp_ports,optional" json:"exposed_tcp_ports,omitempty"`
ExposedUDPPorts []string `cty:"exposed_udp_ports" hcl:"exposed_udp_ports,optional" json:"exposed_udp_ports,omitempty"`
OverridePassword string `cty:"override_password" hcl:"override_password,optional" json:"override_password,omitempty"`
UserGroups []string `cty:"user_groups" hcl:"user_groups,optional" json:"user_groups,omitempty"`
Dependencies []*HostDependency `cty:"depends_on" hcl:"depends_on,block" json:"depends_on,omitempty"`
IO *IO `cty:"io" hcl:"io,block" json:"io,omitempty"`
Vars map[string]string `cty:"vars" hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `cty:"tags" hcl:"tags,optional" json:"tags,omitempty"`
Maintainer *User `cty:"maintainer" hcl:"maintainer,block" json:"maintainer,omitempty"`
OnConflict *OnConflict `cty:"on_conflict" hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Provisioners []Provisioner `json:"-"`
Caller Caller `json:"-"`
Scripts map[string]*Script `json:"-"`
Commands map[string]*Command `json:"-"`
RemoteFiles map[string]*RemoteFile `json:"-"`
DNSRecords map[string]*DNSRecord `json:"-"`
}
Host defines a configurable type for customizing host parameters within the infrastructure.
func (*Host) DependencyCount ¶
func (h *Host) DependencyCount(e *Environment) int
DependencyCount is a helper function used to aggregate the number of dependencies a host has recursively
func (*Host) FinalStepID ¶
FinalStepID gets the final step ID for a host's offset
func (*Host) GetDependencyHash ¶
GetDependencyHash returns the host's dependency hash
func (*Host) GetOnConflict ¶
func (h *Host) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*Host) GetProvisionersHash ¶
GetProvisionersHash returns a concatinated string of the host's provisioners hashes
func (*Host) HasTag ¶
HasTag is a template helper function to return true/false if the host contains a tag of a specific key
func (*Host) IsWindows ¶
IsWindows is a template helper function to determine if the underlying operating system is windows
func (Host) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Host) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Host) ParentLaforgeID ¶
ParentLaforgeID implements the Dependency interface
func (*Host) SetOnConflict ¶
func (h *Host) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Host) TagEquals ¶
TagEquals is a template helper function to return true/false if the host contains a tag key of a specific value
func (*Host) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Host) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Host) ValidatePath ¶
ValidatePath implements the Pather interface
type HostDependency ¶
type HostDependency struct {
HostID string `cty:"host" hcl:"host,attr" json:"host,omitempty"`
NetworkID string `cty:"network" hcl:"network,attr" json:"network,omitempty"`
Step string `cty:"step" hcl:"step,optional" json:"step,omitempty"`
StepID int `cty:"step_id" hcl:"step_id,optional" json:"step_id,omitempty"`
OnConflict *OnConflict `cty:"on_conflict" hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Host *Host `json:"-"`
Network *Network `json:"-"`
}
HostDependency is a configurable type for defining host or network dependencies to allow a dependency graph to be honored during deployment
func (*HostDependency) Hash ¶
func (h *HostDependency) Hash() uint64
Hash implements the Hasher interface
func (HostDependency) MarshalEasyJSON ¶
func (v HostDependency) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (HostDependency) MarshalJSON ¶
func (v HostDependency) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*HostDependency) UnmarshalEasyJSON ¶
func (v *HostDependency) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*HostDependency) UnmarshalJSON ¶
func (v *HostDependency) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type IO ¶
type IO struct {
Stdin string `cty:"stdin" hcl:"stdin,optional" json:"stdin,omitempty"`
Stdout string `cty:"stdout" hcl:"stdout,optional" json:"stdout,omitempty"`
Stderr string `cty:"stderr" hcl:"stderr,optional" json:"stderr,omitempty"`
}
IO represents a configuration type to define file locations for Stdin, Stdout, Stderr
func (IO) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (IO) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*IO) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*IO) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Identity ¶
type Identity struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Firstname string `hcl:"firstname,attr" json:"firstname,omitempty"`
Lastname string `hcl:"lastname,attr" json:"lastname,omitempty"`
Email string `hcl:"email,attr" json:"email,omitempty"`
Password string `hcl:"password,attr" json:"password,omitempty"`
Description string `hcl:"description,optional" json:"description,omitempty"`
AvatarFile string `hcl:"avatar_file,optional" json:"avatar_file,omitempty"`
Vars map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Caller Caller `json:"-"`
}
Identity defines a generic human identity primative that can be extended into Employee, Customer, Client, etc.
func (*Identity) GetOnConflict ¶
func (i *Identity) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (Identity) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Identity) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Identity) ResolveSource ¶
func (i *Identity) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error
ResolveSource attempts to locate the referenced source file with a laforge base configuration
func (*Identity) SetOnConflict ¶
func (i *Identity) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Identity) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Identity) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Identity) ValidatePath ¶
ValidatePath implements the Pather interface
type Include ¶
type Include struct {
Path string `hcl:"path,attr" json:"path,omitempty"`
}
Include defines a named include type
func (Include) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Include) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Include) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Include) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type IncludedNetwork ¶
type IncludedNetwork struct {
Name string `hcl:"name,label" json:"name,omitempty"`
Hosts []string `hcl:"included_hosts,attr" json:"included_hosts,omitempty"`
}
IncludedNetwork is a configuration type used to parse included_hosts out of an environment config.
func (IncludedNetwork) MarshalEasyJSON ¶
func (v IncludedNetwork) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (IncludedNetwork) MarshalJSON ¶
func (v IncludedNetwork) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*IncludedNetwork) String ¶
func (i *IncludedNetwork) String() string
String implments the Stringer interface
func (*IncludedNetwork) UnmarshalEasyJSON ¶
func (v *IncludedNetwork) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*IncludedNetwork) UnmarshalJSON ¶
func (v *IncludedNetwork) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JobStatus ¶
type JobStatus int
JobStatus defines what state the job is in
const ( // JobStatusPlanned is the default assignment given to jobs JobStatusPlanned JobStatus = iota // JobStatusEnqueued is assigned when the job has been put on the channel for work JobStatusEnqueued // JobStatusInProgress is assigned when the job has been picked up off the channel and is being worked JobStatusInProgress // JobStatusFailed is assigned when the job status has failed to continue JobStatusFailed // JobStatusSuccessful is assigned when the job completed successfully JobStatusSuccessful )
type LFType ¶
type LFType string
LFType describes a string representation of elements in Laforge
const ( // LFTypeCompetition is a constant to define object type when serialized LFTypeCompetition LFType = `competition` // LFTypeNetwork is a constant to define object type when serialized LFTypeNetwork LFType = `network` // LFTypeHost is a constant to define object type when serialized LFTypeHost LFType = `host` // LFTypeRemoteFile is a constant to define object type when serialized LFTypeRemoteFile LFType = `remote_file` // LFTypeCommand is a constant to define object type when serialized LFTypeCommand LFType = `command` // LFTypeDNSRecord is a constant to define object type when serialized LFTypeDNSRecord LFType = `dns_record` // LFTypeScript is a constant to define object type when serialized LFTypeScript LFType = `script` // LFTypeEnvironment is a constant to define object type when serialized LFTypeEnvironment LFType = `environment` // LFTypeBuild is a constant to define object type when serialized LFTypeBuild LFType = `build` // LFTypeTeam is a constant to define object type when serialized LFTypeTeam LFType = `team` // LFTypeProvisionedNetwork is a constant to define object type when serialized LFTypeProvisionedNetwork LFType = `provisioned_network` // LFTypeProvisionedHost is a constant to define object type when serialized LFTypeProvisionedHost LFType = `provisioned_host` // LFTypeConnection is a constant to define object type when serialized LFTypeConnection LFType = `connection` // LFTypeProvisioningStep is a constant to define object type when serialized LFTypeProvisioningStep LFType = `provisioning_step` // LFTypeUnknown is totally a fucker LFTypeUnknown LFType = "unknown" )
func TypeByPath ¶
TypeByPath attempts to resolve what type the object is based on it's ID schema
type Laforge ¶
type Laforge struct {
Filename string `json:"filename"`
Includes []string `json:"-"`
DependencyGraph treeprint.Tree `json:"-"`
CurrDir string `json:"-"`
BaseDir string `hcl:"base_dir,optional" json:"base_dir,omitempty"`
User *User `hcl:"user,block" json:"user,omitempty"`
IncludePaths []*Include `hcl:"include,block" json:"include_paths,omitempty"`
DefinedCompetitions []*Competition `hcl:"competition,block" json:"competitions,omitempty"`
DefinedHosts []*Host `hcl:"host,block" json:"hosts,omitempty"`
DefinedNetworks []*Network `hcl:"network,block" json:"networks,omitempty"`
DefinedIdentities []*Identity `hcl:"identity,block" json:"identities,omitempty"`
DefinedScripts []*Script `hcl:"script,block" json:"scripts,omitempty"`
DefinedCommands []*Command `hcl:"command,block" json:"defined_commands,omitempty"`
DefinedRemoteFiles []*RemoteFile `hcl:"remote_file,block" json:"defined_files,omitempty"`
DefinedDNSRecords []*DNSRecord `hcl:"dns_record,block" json:"defined_dns_records,omitempty"`
DefinedEnvironments []*Environment `hcl:"environment,block" json:"environments,omitempty"`
DefinedBuilds []*Build `hcl:"build,block" json:"builds,omitempty"`
DefinedTeams []*Team `hcl:"team,block" json:"teams,omitempty"`
DefinedProvisionedNetworks []*ProvisionedNetwork `hcl:"provisioned_network,block" json:"provisioned_networks,omitempty"`
DefinedProvisionedHosts []*ProvisionedHost `hcl:"provisioned_host,block" json:"provisioned_hosts,omitempty"`
DefinedProvisioningSteps []*ProvisioningStep `hcl:"provisioning_step,block" json:"provisioning_steps,omitempty"`
DefinedConnections []*Connection `hcl:"connection,block" json:"connections,omitempty"`
Hosts map[string]*Host `json:"-"`
Networks map[string]*Network `json:"-"`
Identities map[string]*Identity `json:"-"`
Scripts map[string]*Script `json:"-"`
Commands map[string]*Command `json:"-"`
RemoteFiles map[string]*RemoteFile `json:"-"`
DNSRecords map[string]*DNSRecord `json:"-"`
Competitions map[string]*Competition `json:"-"`
Environments map[string]*Environment `json:"-"`
Builds map[string]*Build `json:"-"`
Teams map[string]*Team `json:"-"`
ProvisionedNetworks map[string]*ProvisionedNetwork `json:"-"`
ProvisionedHosts map[string]*ProvisionedHost `json:"-"`
ProvisioningSteps map[string]*ProvisioningStep `json:"-"`
Connections map[string]*Connection `json:"-"`
Caller Caller `json:"-"`
ValidTeam bool `json:"-"`
ValidBuild bool `json:"-"`
ValidEnv bool `json:"-"`
ValidBase bool `json:"-"`
ValidGlobal bool `json:"-"`
ClearToBuild bool `json:"-"`
TeamRoot string `json:"-"`
BuildRoot string `json:"-"`
EnvRoot string `json:"-"`
BaseRoot string `json:"-"`
GlobalRoot string `json:"-"`
TeamAbsPath string `json:"-"`
BuildAbsPath string `json:"-"`
EnvAbsPath string `json:"-"`
BaseAbsPath string `json:"-"`
TeamContextID string `json:"-"`
BuildContextID string `json:"-"`
EnvContextID string `json:"-"`
BaseContextID string `json:"-"`
GlobalContextID string `json:"-"`
CurrentEnv *Environment `json:"-"`
CurrentBuild *Build `json:"-"`
CurrentTeam *Team `json:"-"`
CurrentCompetition *Competition `json:"-"`
StateManager *State `json:"-"`
InitialContext StateContext `json:"-"`
PathRegistry *PathRegistry `json:"-"`
}
Laforge defines the type that holds the global namespace within the laforge configuration engine
func Bootstrap ¶
Bootstrap performs a full lifecycle bootstrap of the laforge state in a context aware way.
func InitializeBaseContext ¶
InitializeBaseContext returns a base context preset with a base focused configuration
func InitializeBuildContext ¶
InitializeBuildContext returns a base context preset with a build context configuration
func InitializeEnvContext ¶
InitializeEnvContext returns a base context preset with a env focused configuration
func InitializeTeamContext ¶
InitializeTeamContext returns a base context preset with a team context configuration
func Mask ¶
Mask attempts to apply a differential update betweeen base and layer, returning a modified base and any errors it encountered.
func (*Laforge) AssertExactContext ¶
func (l *Laforge) AssertExactContext(s StateContext) error
AssertExactContext allows a program to assert a required context and fail gracefully
func (*Laforge) AssertMinContext ¶
func (l *Laforge) AssertMinContext(s StateContext) error
AssertMinContext allows a program to assert a required context and fail gracefully
func (*Laforge) BaseConfigFile ¶
BaseConfigFile is a helper method for creating an absolute path to the base configuration file
func (*Laforge) BuildConfigFile ¶
BuildConfigFile is a helper method for creating an absolute path to the build results file
func (*Laforge) CleanBuildDirectory ¶
CleanBuildDirectory attempts to purge the current environment context's build directory (rm -r basically)
func (*Laforge) CreateIndex ¶
func (l *Laforge) CreateIndex()
CreateIndex maps out all of the known networks, identities, scripts, commands, and hosts within a laforge configuration snapshot.
func (*Laforge) CurrentStateManager ¶
CurrentStateManager attempts to return the current state manager, throwing an error if it doesn't exist
func (*Laforge) EnvConfigFile ¶
EnvConfigFile is a helper method for creating an absolute path to the environment configuration file
func (*Laforge) GetAllEnvs ¶
GetAllEnvs recursively traverses the BaseRoot/envs/ folder looking for valid environments.
func (*Laforge) GetContext ¶
func (l *Laforge) GetContext() StateContext
GetContext returns the current state's context
func (*Laforge) GlobalConfigFile ¶
GlobalConfigFile is a helper method for creating an absolute path to the global configuration file
func (*Laforge) IdentitiesWithVarEquals ¶
IdentitiesWithVarEquals allows you to retrieve all identites who var key matches value
func (*Laforge) IndexBuildDependencies ¶
IndexBuildDependencies enumerates all known builds and ensures it has competition and environment associations
func (*Laforge) IndexConnectionDependencies ¶
IndexConnectionDependencies enumerates all known connections and ensures they have proper associations
func (*Laforge) IndexEnvironmentDependencies ¶
IndexEnvironmentDependencies enumerates all known environments and makes sure they have valid network inclusions
func (*Laforge) IndexHostDependencies ¶
IndexHostDependencies enumerates all Host objects in the state and indexes their dependencies, reporting errors
func (*Laforge) IndexProvisionedHostDependencies ¶
IndexProvisionedHostDependencies enumerates all known provisioned hosts and ensures they have proper associations
func (*Laforge) IndexProvisionedNetworkDependencies ¶
IndexProvisionedNetworkDependencies enumerates all known provisioned networks and ensures they have proper associations
func (*Laforge) IndexProvisioningStepDependencies ¶
IndexProvisioningStepDependencies enumerates all known provisioning steps and ensures they have proper associations
func (*Laforge) IndexTeamDependencies ¶
IndexTeamDependencies enumerates all known teams and ensures they have proper associations
func (*Laforge) InitializeBaseDirectory ¶
InitializeBaseDirectory configures a skeleton competition repository in the caller's current directory
func (*Laforge) InitializeContext ¶
InitializeContext attempts to resolve the current state context from path traversal
func (*Laforge) InitializeEnv ¶
InitializeEnv attempts to initialize a new environment of a given name
func (*Laforge) LoadFromContext ¶
LoadFromContext attempts to bootstrap the given state from it's assumed Context Level
func (Laforge) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Laforge) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Laforge) TeamConfigFile ¶
TeamConfigFile is a helper method for creating an absolute path to the build results file
func (*Laforge) UniqIdentityVarValues ¶
UniqIdentityVarValues allows you to gather unique var values from within identities
func (*Laforge) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Laforge) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Loader ¶
type Loader struct {
// Parser is the actual HCLv2 parser
Parser *hcl2parse.Parser
// SourceFile is the location of the first file loaded
SourceFile string
// ConfigMap contains all the configuration steps
ConfigMap map[string]*Laforge
// CallerMap contains a reference of what files call what other files
CallerMap map[string]Caller
// Includes is a map of the dependency graph
Includes treeprint.Tree
// FileTree is used to map various parts of the call field
FileTree map[string]treeprint.Tree
}
Loader defines the Laforge configuration loader object
func (*Loader) AddToTree ¶
AddToTree effectively tracks the filetree as it grows from dependencies for the Loader
func (*Loader) Bind ¶
Bind enumerates the Loader's original file, performing recursive include loads to the Loader, generating ASTs for each dependency. Bind finishes with a call to Deconflict().
func (*Loader) Deconflict ¶
Deconflict attempts to perform a state differential on all referenced files by traversing the config files in LIFO order.
func (*Loader) ParseConfigFile ¶
ParseConfigFile loads a root file into Loader
type LocalFileRef ¶
type LocalFileRef struct {
Base string `json:"base,omitempty"`
AbsPath string `json:"abs_path,omitempty"`
RelPath string `json:"rel_path,omitempty"`
Cwd string `json:"cwd,omitempty"`
DeclaredPath string `json:"declared_path,omitempty"`
RelToCallFile string `json:"rel_to_call_file,omitempty"`
}
LocalFileRef is a basic type to hold information about a resolved file that was declared inside a state declaration
func (LocalFileRef) MarshalEasyJSON ¶
func (v LocalFileRef) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (LocalFileRef) MarshalJSON ¶
func (v LocalFileRef) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*LocalFileRef) UnmarshalEasyJSON ¶
func (v *LocalFileRef) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*LocalFileRef) UnmarshalJSON ¶
func (v *LocalFileRef) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Manager ¶
type Manager struct {
Acks chan Doer
Errors chan error
Shutdown chan bool
Inbound chan Doer
Laforge *Laforge
}
Manager is a looped processor of tasks by the state machine
type Mergeable ¶
type Mergeable interface {
// GetCaller retrieves the object's Caller value
GetCaller() Caller
// LaforgeID retrieves the object's ID value
LaforgeID() string
// GetOnConflict retrieves the object's OnConflict value
GetOnConflict() OnConflict
// SetCaller sets the object's Caller to a new version
SetCaller(ca Caller)
// SetOnConflict replaces the object's OnConflict with a new version
SetOnConflict(oc OnConflict)
// Swap attempts to replace the pointer references of two mergeable objects
Swap(ma Mergeable) error
}
Mergeable is an interface that allows for dynamic types to be merged with coordinated strategies
type MetaResource ¶
type MetaResource struct {
ID string `json:"id,omitempty"`
PathFromBase string `json:"path_from_base,omitempty"`
Basename string `json:"basename,omitempty"`
ParentIDs []string `json:"parent_ids,omitempty"`
IsDir bool `json:"is_dir,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
ModifiedAt time.Time `json:"modified_at,omitempty"`
Checksum uint64 `json:"checksum,omitempty"`
Size int `json:"size,omitempty"`
}
MetaResource stores information about a local file dependency. This can be a directory. If the resource is a directory, it will be recursively gzip'd and that will be checksum'd. If the resource is a directory, size will be the size of the final gzip file. Note creation and modification date refer to meta resource validation, not the actual file.
func (MetaResource) MarshalEasyJSON ¶
func (v MetaResource) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (MetaResource) MarshalJSON ¶
func (v MetaResource) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*MetaResource) UnmarshalEasyJSON ¶
func (v *MetaResource) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MetaResource) UnmarshalJSON ¶
func (v *MetaResource) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Metadata ¶
type Metadata struct {
Dependency Dependency `json:"-"`
ID string `json:"id"`
ObjectType LFType `json:"object_type"`
Created bool `json:"provisioned,omitempty"`
Tainted bool `json:"tainted,omitempty"`
Addition bool `json:"addition,omitempty"`
Checksum uint64 `json:"checksum,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
ModifiedAt time.Time `json:"modified_at,omitempty"`
Resources []MetaResource `json:"resources,omitempty"`
}
Metadata stores metadata about different structs within the environment
func (*Metadata) CalculateChecksum ¶
func (m *Metadata) CalculateChecksum()
CalculateChecksum assigns the metadata object's checksum field with the dependency's hash
func (*Metadata) GetChecksum ¶
GetChecksum implements the DotNode interface
func (*Metadata) Hashcode ¶
func (m *Metadata) Hashcode() interface{}
Hashcode implements the Hashable interface
func (*Metadata) IsGlobalType ¶
IsGlobalType is a helper function specifically for metadata to call IsGlobalType easily
func (Metadata) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Metadata) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Metadata) ToRevision ¶
ToRevision generates a revision object for m
func (*Metadata) TypeByPath ¶
TypeByPath is a helper function specifically for metadata to call TypeByPath easily
func (*Metadata) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Metadata) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Network ¶
type Network struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
CIDR string `hcl:"cidr,attr" json:"cidr,omitempty"`
VDIVisible bool `hcl:"vdi_visible,optional" json:"vdi_visible,omitempty"`
Vars map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Caller Caller `json:"-"`
}
Network defines a network within a competition environment
func (*Network) GetOnConflict ¶
func (n *Network) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (Network) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Network) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Network) Octet ¶
Octet is a template helper function to get a network's octet at a specified offset
func (*Network) ParentLaforgeID ¶
ParentLaforgeID implements the Dependency interface
func (*Network) SetOnConflict ¶
func (n *Network) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Network) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Network) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Network) ValidatePath ¶
ValidatePath implements the Pather interface
type OnConflict ¶
type OnConflict struct {
Do string `cty:"do" hcl:"do,attr" json:"do,omitempty"`
Append bool `cty:"append" hcl:"append,optional" json:"append,omitempty"`
}
OnConflict defines a configuration override for how to handle conflicting objects in the differential enumeration of objects. For example, if you have a file that has loaded a host definition (host "foo" {...}) and you have included an additional configuration in your env.laforge, you can specify an on_conflict { do = "" } setting within your block to control how the state of host "foo" has state changes applied to it.
host "foo" {
on_conflict {
do = "overwrite"
}
}
The default behavior (no on_conflict block) is to perform an overriding MERGE on the original object with your changes. Think of this as updating only fields you have defined and are non-zero. If you wish to specify a different strategy, the following ones are valid:
- "overwrite" will replace the entirety of original "foo" with your definition, discarding any previous state.
- "inherit" will apply a merge in reverse - merging the original "foo" into your definition, overwriting any fields.
- "panic" will raise a runtime error and prevent further execution. This can be a very helpful way to avoid state on "root" definitions.
func (OnConflict) MarshalEasyJSON ¶
func (v OnConflict) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (OnConflict) MarshalJSON ¶
func (v OnConflict) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*OnConflict) UnmarshalEasyJSON ¶
func (v *OnConflict) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*OnConflict) UnmarshalJSON ¶
func (v *OnConflict) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Opt ¶
type Opt struct {
Key string `hcl:",label" json:"key,omitempty"`
Value string `hcl:"value,attr" json:"value,omitempty"`
}
Opt defines a basic HCLv2 option label:
config "keyName" {
value = "valueData"
}
func (Opt) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Opt) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Opt) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Opt) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type OutputCallback ¶
OutputCallback is used to monitor the output of terraform as it runs
type PathRegistry ¶
type PathRegistry struct {
DB map[CallFile]*PathResolver // key = composite of $type.$id, value = PathResolver
}
PathRegistry is a type that tracks the relative file paths of state configurations that include external sources
type PathResolver ¶
type PathResolver struct {
Mapping map[string]*LocalFileRef // map[provided_path_declaration] => LocalFileRef
Unresolved map[string]bool // map[provided_path_declaration] => true when we can't resolve it
}
PathResolver defines the mapping of paths declared in a CallFile and their mapping to files on local disk or lack of resolution
type Plan ¶
type Plan struct {
TaskGroundDelay int `json:"ground_delay"`
Base *Laforge `json:"-"`
Checksum uint64 `json:"checksum"`
StartedAt time.Time `json:"started_at"`
EndedAt time.Time `json:"ended_at"`
Graph *Snapshot `json:"target,omitempty"`
TaskTypes map[string]string `json:"task_types"`
Tasks map[string]Doer `json:"-"`
TasksByPriority map[int][]string `json:"tasks_by_priority"`
GlobalOrder []string `json:"global_order"`
OrderedPriorities []int `json:"ordered_priorities"`
Tainted map[string]bool `json:"tainted"`
TaintedHosts map[string]bool `json:"tainted_hosts"`
Walker *dag.Walker `json:"-"`
Errored bool `json:"-"`
FailedNodes *dag.Set `json:"-"`
}
Plan is a type that describes how to get from one state to the next
func NewEmptyPlan ¶
func NewEmptyPlan() *Plan
NewEmptyPlan returns an initialized, but empty plan object.
func (*Plan) BurnIt ¶
BurnIt is the stub for destroying all terraform environments and their dependencies
func (*Plan) Execute ¶
func (p *Plan) Execute() tfdiags.Diagnostics
Execute walks the plan's functions against the computed dependency graph
func (Plan) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Plan) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Plan) Orchestrator ¶
func (p *Plan) Orchestrator(v dag.Vertex) (d tfdiags.Diagnostics)
Orchestrator is the walk function that is executed for each path in the dependency graph
func (*Plan) Preflight ¶
Preflight determines what teams need terraform run on them, executing them before the plan
func (*Plan) RemoveRevisionFilesFromTeams ¶
RemoveRevisionFilesFromTeams walks the team directory in the current build and removes them
func (*Plan) SetupTasks ¶
SetupTasks attempts to cull the Tasks map with Doer types to actually be performed
func (*Plan) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Plan) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ProvisionStatus ¶
type ProvisionStatus string
ProvisionStatus describes components of a provisioned environment and the various states they're in
const ( // ProvStatusUndefined represents an empty provision state ProvStatusUndefined ProvisionStatus = "" // ProvStatusAwaiting represents a provisionable object that has been indexed, but not implemented ProvStatusAwaiting ProvisionStatus = "AWAITING" // ProvStatusInProgress represents a provisioanble object that has been indexed ans is in the process of being implemented. ProvStatusInProgress ProvisionStatus = "INPROGRESS" // ProvStatusFailed represents a provisioanble object that failed during it's implementation. ProvStatusFailed ProvisionStatus = "FAILED" // ProvStatusComplete represents a provisionable object that has successfully been implemented. ProvStatusComplete ProvisionStatus = "COMPLETE" // ProvStatusTainted represents a provisionable object that has been implemented, but is marked for re-implementation. ProvStatusTainted ProvisionStatus = "TAINTED" )
type ProvisionedHost ¶
type ProvisionedHost struct {
ID string `hcl:"id,label" json:"id,omitempty"`
HostID string `hcl:"host_id,attr" json:"host_id,omitempty"`
SubnetIP string `hcl:"subnet_ip,attr" json:"subnet_ip,omitempty"`
Conn *Connection `hcl:"connection,block" json:"connection"`
Status Status `hcl:"status,optional" json:"status"`
ProvisioningSteps map[string]*ProvisioningStep `json:"provisioning_steps"`
StepsByOffset []*ProvisioningStep `json:"-"`
ProvisionedNetwork *ProvisionedNetwork `json:"-"`
Team *Team `json:"-"`
Build *Build `json:"-"`
Environment *Environment `json:"-"`
Competition *Competition `json:"-"`
Network *Network `json:"-"`
Host *Host `json:"-"`
OnConflict *OnConflict `json:"-"`
Caller Caller `json:"-"`
Dir string `json:"-"`
}
ProvisionedHost is a build artifact type to denote a host inside a team's provisioend infrastructure.
func (*ProvisionedHost) ActualPassword ¶
func (p *ProvisionedHost) ActualPassword() string
ActualPassword attempts to get everything just right interms of what the actual password of this machine is
func (*ProvisionedHost) Base ¶
func (p *ProvisionedHost) Base() string
Base implements the Pather interface
func (*ProvisionedHost) CreateConnection ¶
func (p *ProvisionedHost) CreateConnection() *Connection
CreateConnection creates this host's skeleton connection file to be used
func (*ProvisionedHost) CreateProvisioningStep ¶
func (p *ProvisionedHost) CreateProvisioningStep(pr Provisioner, offset int) *ProvisioningStep
CreateProvisioningStep creates a new provisioning step object for the provisioned host, mapping parent objects.
func (*ProvisionedHost) CreateProvisioningSteps ¶
func (p *ProvisionedHost) CreateProvisioningSteps() error
CreateProvisioningSteps enumerates all the parent Host object's provisioning steps, mapping a custom ProvisioningStep object for this provisioned host.
func (*ProvisionedHost) Gather ¶
func (p *ProvisionedHost) Gather(g *Snapshot) error
Gather implements the Dependency interface
func (*ProvisionedHost) GetCaller ¶
func (p *ProvisionedHost) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*ProvisionedHost) GetOnConflict ¶
func (p *ProvisionedHost) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*ProvisionedHost) Hash ¶
func (p *ProvisionedHost) Hash() uint64
Hash implements the Hasher interface
func (*ProvisionedHost) LaforgeID ¶
func (p *ProvisionedHost) LaforgeID() string
LaforgeID implements the Mergeable interface This will be: /envs/$env_base/$build_base/teams/$team_base/networks/$network_base/$host_base
func (ProvisionedHost) MarshalEasyJSON ¶
func (v ProvisionedHost) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ProvisionedHost) MarshalJSON ¶
func (v ProvisionedHost) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ProvisionedHost) ParentLaforgeID ¶
func (p *ProvisionedHost) ParentLaforgeID() string
ParentLaforgeID returns the Team's parent build ID
func (*ProvisionedHost) Path ¶
func (p *ProvisionedHost) Path() string
Path implements the Pather interface
func (*ProvisionedHost) SetCaller ¶
func (p *ProvisionedHost) SetCaller(ca Caller)
SetCaller implements the Mergeable interface
func (*ProvisionedHost) SetID ¶
func (p *ProvisionedHost) SetID() string
SetID increments the revision and sets the team ID if needed
func (*ProvisionedHost) SetOnConflict ¶
func (p *ProvisionedHost) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*ProvisionedHost) Swap ¶
func (p *ProvisionedHost) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*ProvisionedHost) UnmarshalEasyJSON ¶
func (v *ProvisionedHost) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ProvisionedHost) UnmarshalJSON ¶
func (v *ProvisionedHost) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*ProvisionedHost) ValidatePath ¶
func (p *ProvisionedHost) ValidatePath() error
ValidatePath implements the Pather interface
type ProvisionedNetwork ¶
type ProvisionedNetwork struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
CIDR string `hcl:"cidr,attr" json:"cidr,omitempty"`
NetworkID string `hcl:"network_id,attr" json:"network_id,omitempty"`
ProvisionedHosts map[string]*ProvisionedHost `json:"provisioned_hosts"`
Status Status `hcl:"status,optional" json:"status"`
Network *Network `json:"-"`
Team *Team `json:"-"`
Build *Build `json:"-"`
Environment *Environment `json:"-"`
Competition *Competition `json:"-"`
OnConflict *OnConflict `json:"-"`
Caller Caller `json:"-"`
Dir string `json:"-"`
}
ProvisionedNetwork is a build artifact type to denote a network inside a team's provisioend infrastructure.
func (*ProvisionedNetwork) Base ¶
func (p *ProvisionedNetwork) Base() string
Base implements the Pather interface
func (*ProvisionedNetwork) CreateProvisionedHost ¶
func (p *ProvisionedNetwork) CreateProvisionedHost(host *Host) *ProvisionedHost
CreateProvisionedHost creates the actual provisioned host object and assigns the parental objects accordingly.
func (*ProvisionedNetwork) CreateProvisionedHosts ¶
func (p *ProvisionedNetwork) CreateProvisionedHosts() error
CreateProvisionedHosts enumerates the parent environment's host by network and creates provisioned host objects in this tree.
func (*ProvisionedNetwork) Gather ¶
func (p *ProvisionedNetwork) Gather(g *Snapshot) error
Gather implements the Dependency interface
func (*ProvisionedNetwork) GetCaller ¶
func (p *ProvisionedNetwork) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*ProvisionedNetwork) GetOnConflict ¶
func (p *ProvisionedNetwork) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*ProvisionedNetwork) Hash ¶
func (p *ProvisionedNetwork) Hash() uint64
Hash implements the Hasher interface
func (*ProvisionedNetwork) LaforgeID ¶
func (p *ProvisionedNetwork) LaforgeID() string
LaforgeID implements the Mergeable interface
func (ProvisionedNetwork) MarshalEasyJSON ¶
func (v ProvisionedNetwork) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ProvisionedNetwork) MarshalJSON ¶
func (v ProvisionedNetwork) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ProvisionedNetwork) ParentLaforgeID ¶
func (p *ProvisionedNetwork) ParentLaforgeID() string
ParentLaforgeID returns the Team's parent build ID
func (*ProvisionedNetwork) Path ¶
func (p *ProvisionedNetwork) Path() string
Path implements the Pather interface
func (*ProvisionedNetwork) SetCaller ¶
func (p *ProvisionedNetwork) SetCaller(ca Caller)
SetCaller implements the Mergeable interface
func (*ProvisionedNetwork) SetID ¶
func (p *ProvisionedNetwork) SetID() string
SetID increments the revision and sets the team ID if needed
func (*ProvisionedNetwork) SetOnConflict ¶
func (p *ProvisionedNetwork) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*ProvisionedNetwork) Swap ¶
func (p *ProvisionedNetwork) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*ProvisionedNetwork) UnmarshalEasyJSON ¶
func (v *ProvisionedNetwork) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ProvisionedNetwork) UnmarshalJSON ¶
func (v *ProvisionedNetwork) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*ProvisionedNetwork) ValidatePath ¶
func (p *ProvisionedNetwork) ValidatePath() error
ValidatePath implements the Pather interface
type Provisioner ¶
type Provisioner interface {
graph.Hasher
Pather
Gather(s *Snapshot) error
ParentLaforgeID() string
// Kind denotes the type of Provisioner this is
Kind() string
}
Provisioner is a meta interface to provide provisioning steps to the Builder
type ProvisioningStep ¶
type ProvisioningStep struct {
ID string `hcl:"id,label" json:"id,omitempty"`
ProvisionerID string `hcl:"provisioner_id,attr" json:"provisioner_id,omitempty"`
ProvisionerType string `hcl:"provisioner_type,attr" json:"provisioner_type,omitempty"`
StepNumber int `hcl:"step_number,attr" json:"step_number,omitempty"`
Status string `hcl:"status,optional" json:"status,omitempty"`
ProvisionedHost *ProvisionedHost `json:"-"`
ProvisionedNetwork *ProvisionedNetwork `json:"-"`
Host *Host `json:"-"`
Network *Network `json:"-"`
Team *Team `json:"-"`
Build *Build `json:"-"`
Environment *Environment `json:"-"`
Competition *Competition `json:"-"`
Provisioner Provisioner `json:"-"`
Script *Script `json:"-"`
Command *Command `json:"-"`
RemoteFile *RemoteFile `json:"-"`
DNSRecord *DNSRecord `json:"-"`
OnConflict *OnConflict `json:"-"`
Caller Caller `json:"-"`
Dir string `json:"-"`
}
ProvisioningStep is a build artifact type to denote a specific step inside of a provisioned host
func (*ProvisioningStep) Base ¶
func (p *ProvisioningStep) Base() string
Base implements the Pather interface
func (*ProvisioningStep) Gather ¶
func (p *ProvisioningStep) Gather(g *Snapshot) error
Gather implements the Dependency interface
func (*ProvisioningStep) GetCaller ¶
func (p *ProvisioningStep) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*ProvisioningStep) GetOnConflict ¶
func (p *ProvisioningStep) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*ProvisioningStep) Hash ¶
func (p *ProvisioningStep) Hash() uint64
Hash implements the Hasher interface
func (*ProvisioningStep) LaforgeID ¶
func (p *ProvisioningStep) LaforgeID() string
LaforgeID implements the Mergeable interface
func (ProvisioningStep) MarshalEasyJSON ¶
func (v ProvisioningStep) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ProvisioningStep) MarshalJSON ¶
func (v ProvisioningStep) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ProvisioningStep) ParentLaforgeID ¶
func (p *ProvisioningStep) ParentLaforgeID() string
ParentLaforgeID returns the Team's parent build ID
func (*ProvisioningStep) Path ¶
func (p *ProvisioningStep) Path() string
Path implements the Pather interface
func (*ProvisioningStep) SetCaller ¶
func (p *ProvisioningStep) SetCaller(ca Caller)
SetCaller implements the Mergeable interface
func (*ProvisioningStep) SetID ¶
func (p *ProvisioningStep) SetID() string
SetID increments the revision and sets the team ID if needed
func (*ProvisioningStep) SetOnConflict ¶
func (p *ProvisioningStep) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*ProvisioningStep) Swap ¶
func (p *ProvisioningStep) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*ProvisioningStep) UnmarshalEasyJSON ¶
func (v *ProvisioningStep) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ProvisioningStep) UnmarshalJSON ¶
func (v *ProvisioningStep) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*ProvisioningStep) ValidatePath ¶
func (p *ProvisioningStep) ValidatePath() error
ValidatePath implements the Pather interface
type RelateFunc ¶
type RelateFunc func() error
RelateFunc is a type alias to a function that relates objects together in a promise style format
type Remote ¶
type Remote struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Type string `hcl:"type,attr" json:"type,omitempty"`
Config map[string]string `hcl:"config,optional" json:"config,omitempty"`
}
Remote defines a configuration object that keeps terraform and remote files synchronized
func (Remote) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Remote) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Remote) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Remote) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type RemoteCommand ¶
type RemoteCommand struct {
Command string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
sync.Mutex
// contains filtered or unexported fields
}
RemoteCommand represents a remote command being prepared or run.
func NewRemoteCommand ¶
func NewRemoteCommand() *RemoteCommand
NewRemoteCommand creates a new empty remote command object
func (*RemoteCommand) Init ¶
func (r *RemoteCommand) Init()
Init must be called before executing the command.
func (*RemoteCommand) SetExitStatus ¶
func (r *RemoteCommand) SetExitStatus(status int, err error)
SetExitStatus stores the exit status of the remote command
func (*RemoteCommand) Wait ¶
func (r *RemoteCommand) Wait() error
Wait waits for the remote command to complete.
type RemoteFile ¶
type RemoteFile struct {
ID string `hcl:"id,label" json:"id,omitempty"`
SourceType string `hcl:"source_type,attr" json:"source_type,omitempty"`
Source string `hcl:"source,attr" json:"source,omitempty"`
Destination string `hcl:"destination,attr" json:"destination,omitempty"`
Vars map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
Template bool `hcl:"template,optional" json:"template,omitempty"`
Perms string `hcl:"perms,optional" json:"perms,omitempty"`
Disabled bool `hcl:"disabled,optional" json:"disabled,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
MD5 string `hcl:"md5,optional" json:"md5,omitempty"`
Caller Caller `json:"-"`
AbsPath string `json:"-"`
Ext string `json:"-"`
}
RemoteFile is a configurable type that defines a static file that will be placed on a configured target host.
func (*RemoteFile) AssetName ¶
func (r *RemoteFile) AssetName() (string, error)
AssetName returns the asset's name calculated as intended
func (*RemoteFile) CopyTo ¶
func (r *RemoteFile) CopyTo(dst string) error
CopyTo copies the local file to another location on the local machine
func (*RemoteFile) Fullpath ¶
func (r *RemoteFile) Fullpath() string
Fullpath implements the Pather interface
func (*RemoteFile) Gather ¶
func (r *RemoteFile) Gather(g *Snapshot) error
Gather implements the Dependency interface
func (*RemoteFile) GetCaller ¶
func (r *RemoteFile) GetCaller() Caller
GetCaller implements the Mergeable interface
func (*RemoteFile) GetOnConflict ¶
func (r *RemoteFile) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*RemoteFile) Kind ¶
func (r *RemoteFile) Kind() string
Kind implements the Provisioner interface
func (*RemoteFile) LaforgeID ¶
func (r *RemoteFile) LaforgeID() string
LaforgeID implements the Mergeable interface
func (*RemoteFile) MD5Sum ¶
func (r *RemoteFile) MD5Sum() (string, error)
MD5Sum returns the MD5 checksum of a local file
func (RemoteFile) MarshalEasyJSON ¶
func (v RemoteFile) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (RemoteFile) MarshalJSON ¶
func (v RemoteFile) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*RemoteFile) ParentLaforgeID ¶
func (r *RemoteFile) ParentLaforgeID() string
ParentLaforgeID implements the Dependency interface
func (*RemoteFile) ResolveSource ¶
func (r *RemoteFile) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error
ResolveSource attempts to locate the referenced source file with a laforge base configuration
func (*RemoteFile) ResourceHash ¶
func (r *RemoteFile) ResourceHash() uint64
ResourceHash implements the ResourceHasher interface
func (*RemoteFile) SetCaller ¶
func (r *RemoteFile) SetCaller(c Caller)
SetCaller implements the Mergeable interface
func (*RemoteFile) SetOnConflict ¶
func (r *RemoteFile) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*RemoteFile) Swap ¶
func (r *RemoteFile) Swap(m Mergeable) error
Swap implements the Mergeable interface
func (*RemoteFile) UnmarshalEasyJSON ¶
func (v *RemoteFile) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RemoteFile) UnmarshalJSON ¶
func (v *RemoteFile) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
func (*RemoteFile) ValidatePath ¶
func (r *RemoteFile) ValidatePath() error
ValidatePath implements the Pather interface
type RemoteFileJob ¶
type RemoteFileJob struct {
GenericJob
Target *ProvisioningStep `json:"-"`
RemoteFile *RemoteFile `json:"-"`
AssetPath string `json:"asset_path,omitempty"`
}
RemoteFileJob attempts to upload a file to the remote machine easyjson:json
func CreateRemoteFileJob ¶
func CreateRemoteFileJob(id string, offset int, m *Metadata, pstep *ProvisioningStep) (*RemoteFileJob, error)
CreateRemoteFileJob creates a new remote file job for a Doer object within the Planner
func (*RemoteFileJob) CanProceed ¶
func (j *RemoteFileJob) CanProceed() error
CanProceed implements the Doer interface
func (*RemoteFileJob) CleanUp ¶
func (j *RemoteFileJob) CleanUp() error
CleanUp implements the Doer interface
func (*RemoteFileJob) EnsureDependencies ¶
func (j *RemoteFileJob) EnsureDependencies(l *Laforge) error
EnsureDependencies implements the Doer interface
func (*RemoteFileJob) Finish ¶
func (j *RemoteFileJob) Finish() error
Finish implements the Doer interface
func (RemoteFileJob) MarshalEasyJSON ¶
func (v RemoteFileJob) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (RemoteFileJob) MarshalJSON ¶
func (v RemoteFileJob) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*RemoteFileJob) UnmarshalEasyJSON ¶
func (v *RemoteFileJob) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RemoteFileJob) UnmarshalJSON ¶
func (v *RemoteFileJob) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResourceHasher ¶
type ResourceHasher interface {
ResourceHash() uint64
}
ResourceHasher is an interface to define types who have file dependencies to checkum them
type RevMod ¶
type RevMod string
RevMod is an internal type alias to label needs of objects within an environments deployment
type RevStatus ¶
type RevStatus string
RevStatus is a type used to describe the current state of the revision
type Revision ¶
type Revision struct {
ID string `json:"id"`
Type LFType `json:"type"`
Status RevStatus `json:"status"`
Checksum uint64 `json:"checksum"`
Timestamp time.Time `json:"timestamp"`
ExternalID string `json:"external_id"`
Vars map[string]string `json:"vars"`
}
Revision is used to describe a small .lfrevision file placed in the root of each path
func ParseRevisionFile ¶
ParseRevisionFile attempts to parse a revision file at the given location
func (Revision) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Revision) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Revision) ToJSONString ¶
ToJSONString converts the revision to a JSON string
func (*Revision) Touch ¶
Touch sets the current timestamp and status to active for use within templating engines
func (*Revision) TouchWithID ¶
TouchWithID touches the revision and updates it's External ID resource
func (*Revision) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Revision) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type SSHAuthConfig ¶
type SSHAuthConfig struct {
RemoteAddr string `hcl:"remote_addr,attr" json:"remote_addr,omitempty"`
Port int `hcl:"port,attr" json:"port,omitempty"`
User string `hcl:"user,attr" json:"user,omitempty"`
Password string `hcl:"password,optional" json:"password,omitempty"`
IdentityFile string `hcl:"identity_file,optional" json:"identity_file,omitempty"`
IdentityFileRef *LocalFileRef `json:"-"`
}
SSHAuthConfig defines how Laforge should connect via SSH to a provisioned host
func (*SSHAuthConfig) Hash ¶
func (s *SSHAuthConfig) Hash() uint64
Hash implements the Hasher interface
func (*SSHAuthConfig) LoadIdentityFile ¶
func (s *SSHAuthConfig) LoadIdentityFile(base *Laforge, pr *PathResolver, caller CallFile) error
LoadIdentityFile attempts to locate the referenced source file with a laforge base configuration
func (SSHAuthConfig) MarshalEasyJSON ¶
func (v SSHAuthConfig) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SSHAuthConfig) MarshalJSON ¶
func (v SSHAuthConfig) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SSHAuthConfig) Protocol ¶
func (s *SSHAuthConfig) Protocol() string
Protocol implements the ShellConfig interface
func (*SSHAuthConfig) UnmarshalEasyJSON ¶
func (v *SSHAuthConfig) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SSHAuthConfig) UnmarshalJSON ¶
func (v *SSHAuthConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
SSHClient represents the client that connects to a remote server via SSH
func NewSSHClient ¶
func NewSSHClient(sshconf *SSHAuthConfig, overrideKey string) (*SSHClient, error)
NewSSHClient creates a new communicator implementation over SSH.
func (*SSHClient) DeleteScriptV2 ¶
DeleteScriptV2 uses the 3rd party pkg/sftp Go package to securely erase a file
func (*SSHClient) Disconnect ¶
Disconnect implementation of communicator.Communicator interface
func (*SSHClient) LaunchInteractiveShell ¶
LaunchInteractiveShell launches an interactive SSH session through the terminal
func (*SSHClient) Start ¶
func (s *SSHClient) Start(cmd *RemoteCommand) error
Start executes a remote command on the host
func (*SSHClient) UploadFileV2 ¶
UploadFileV2 uses the 3rd party pkg/sftp Go package to upload instead of native x/ssh with scp modes.
func (*SSHClient) UploadScript ¶
UploadScript uploads a script for execution to the remote host
func (*SSHClient) UploadScriptV2 ¶
UploadScriptV2 uses the 3rd party pkg/sftp Go package to upload instead of native x/ssh with scp modes.
type Script ¶
type Script struct {
ID string `hcl:"id,label" json:"id,omitempty"`
Name string `hcl:"name,attr" json:"name,omitempty"`
Language string `hcl:"language,attr" json:"language,omitempty"`
Description string `hcl:"description,optional" json:"description,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
Source string `hcl:"source,attr" json:"source,omitempty"`
SourceType string `hcl:"source_type,attr" json:"source_type,omitempty"`
Cooldown int `hcl:"cooldown,optional" json:"cooldown,omitempty"`
IgnoreErrors bool `hcl:"ignore_errors,optional" json:"ignore_errors,omitempty"`
Args []string `hcl:"args,optional" json:"args,omitempty"`
IO *IO `hcl:"io,block" json:"io,omitempty"`
Disabled bool `hcl:"disabled,optional" json:"disabled,omitempty"`
Vars map[string]string `hcl:"vars,optional" json:"vars,omitempty"`
Tags map[string]string `hcl:"tags,optional" json:"tags,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Findings []*Finding `hcl:"finding,block" json:"findings,omitempty"`
AbsPath string `json:"-"`
Caller Caller `json:"-"`
}
Script defines a configurable type for an executable script object within the laforge configuration
func (*Script) ArgString ¶
ArgString is a template helper function to embed the arg string into the output
func (*Script) GetOnConflict ¶
func (s *Script) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (Script) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Script) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Script) ParentLaforgeID ¶
ParentLaforgeID implements the Dependency interface
func (*Script) ResolveSource ¶
func (s *Script) ResolveSource(base *Laforge, pr *PathResolver, caller CallFile) error
ResolveSource attempts to locate the referenced source file with a laforge base configuration
func (*Script) ResourceHash ¶
ResourceHash implements the ResourceHasher interface
func (*Script) SetOnConflict ¶
func (s *Script) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Script) SourceBase ¶
SourceBase is a template helper function to return the base filename of a source script
func (*Script) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Script) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Script) ValidatePath ¶
ValidatePath implements the Pather interface
type ScriptJob ¶
type ScriptJob struct {
GenericJob
Target *ProvisioningStep `json:"-"`
Script *Script `json:"-"`
AssetPath string `json:"asset_path,omitempty"`
}
ScriptJob attempts to upload and execute a script on the remote system easyjson:json
func CreateScriptJob ¶
func CreateScriptJob(id string, offset int, m *Metadata, pstep *ProvisioningStep) (*ScriptJob, error)
CreateScriptJob creates a new script job for a Doer object with the Planner
func (*ScriptJob) CanProceed ¶
CanProceed implements the Doer interface
func (*ScriptJob) EnsureDependencies ¶
EnsureDependencies implements the Doer interface
func (ScriptJob) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (ScriptJob) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*ScriptJob) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ScriptJob) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ShellConfig ¶
type ShellConfig interface {
// Protocol denotes the protocol to be used
Protocol() string
}
ShellConfig is a generic type for shell configurations
type Snapshot ¶
type Snapshot struct {
Checksum uint64 `json:"checksum"`
AltGraph *dag.AcyclicGraph `json:"altgraph"`
Metastore map[string]*Metadata `json:"metadata"`
RootID string `json:"root_id"`
Edges interface{} `json:"edges"`
Metabus chan *Metadata `json:"-"`
Nodebus chan *Metadata `json:"-"`
Edgebus chan Edge `json:"-"`
Mutex *sync.RWMutex `json:"-"`
}
Snapshot is a graph traversal structure used to create a unique fingerprint for all elements in an environment. easyjson:json
func NewEmptySnapshot ¶
func NewEmptySnapshot() *Snapshot
NewEmptySnapshot returns an empty snapshot object
func NewSnapshotFromEnv ¶
func NewSnapshotFromEnv(e *Environment, overwriteBuild bool) (*Snapshot, error)
NewSnapshotFromEnv creates a new snapshot from a provided environment
func (*Snapshot) AddObject ¶
func (s *Snapshot) AddObject(dep Dependency)
AddObject adds a dependency to the Metastore
func (*Snapshot) AddRelationship ¶
func (s *Snapshot) AddRelationship(src Dependency, target Dependency)
AddRelationship places a relationship on the Edgebus
func (*Snapshot) GetEdges ¶
func (s *Snapshot) GetEdges() mapset.Set
GetEdges returns a type asserted set of edges
func (Snapshot) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Snapshot) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Snapshot) PopulateGraph ¶
func (s *Snapshot) PopulateGraph(end chan struct{}, fin chan struct{})
PopulateGraph places items on the graph with a default root value
func (*Snapshot) RebuildGraph ¶
RebuildGraph will attempt to recreate the dependency tree based on it's persisted metadata instead of building from environment.
func (*Snapshot) Relate ¶
func (s *Snapshot) Relate(root Dependency, leafs ...Dependency) error
Relate takes a root dependency, and creates associations in the graph from it to the leafs. DEPRECATED
func (*Snapshot) RelateObjects ¶
func (s *Snapshot) RelateObjects(end chan struct{}, fin chan struct{})
RelateObjects monitors the edgebus channel for objects that need edges defined in the graph
func (*Snapshot) StoreMetadata ¶
func (s *Snapshot) StoreMetadata(end chan struct{}, fin chan struct{})
StoreMetadata creates entries in the snapshot's Metastore
func (*Snapshot) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Snapshot) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Snapshot) WalkEnvironment ¶
func (s *Snapshot) WalkEnvironment(e *Environment, wg *sync.WaitGroup)
WalkEnvironment walks the environment looking for dependencies to graph
func (*Snapshot) WalkProvisionedHost ¶
func (s *Snapshot) WalkProvisionedHost(ph *ProvisionedHost, wg *sync.WaitGroup)
WalkProvisionedHost is used to walk all the elements of a provisioned host
type State ¶
type State struct {
Base *Laforge
DB *buntdb.DB
Current *Snapshot
Persisted *Snapshot
Plan *Plan
NewRevs map[string]*Revision
KnownRevs map[string]*Revision
RevDelta map[string]RevMod
}
State is the primary object used to interface with the build's on disk state table
func BootstrapWithState ¶
BootstrapWithState wraps much of the bootstrap process with a state tree calculation as well
func (*State) CalculateDelta ¶
CalculateDelta attempts to determine what needs to be done to bring a base in line with target
func (*State) CreateDBSchema ¶
CreateDBSchema attempts to create the database indexes appropriately
func (*State) GenerateCurrentRevs ¶
GenerateCurrentRevs enumerates the current snapshot and generates a listing of revisions for comparison
func (*State) GenerateRevisionDelta ¶
GenerateRevisionDelta compares the known verses the new revisiosn and comes up with a strategy which is used in the plan calculations.
func (*State) InitializeEmptyPersistedSnapshot ¶
InitializeEmptyPersistedSnapshot sets the persisted snapshot in the state to an empty one
func (*State) KnownRevHashes ¶
KnownRevHashes returns a hash of the located revision objects
func (*State) LoadSnapshotFromDB ¶
LoadSnapshotFromDB attempts to load the last Snapshot object from the DB, assigning it to *State.Persisted and returning it if it was successful.
func (*State) LocateRevisions ¶
LocateRevisions attempts to load the known revision files off disk
func (*State) NewRevHashes ¶
NewRevHashes returns a hash of the new revision objects
func (*State) PersistSnapshot ¶
PersistSnapshot will save the provided snapshot into the current snapshot entry of the database, overwriting any existing snapshot.
func (*State) SetCurrent ¶
SetCurrent sets the current snapshot
func (*State) SnapshotsEqual ¶
SnapshotsEqual are used to test the equality of the two environments and their dependencies
type StateContext ¶
type StateContext int
StateContext is a type alias to the level of context we are currently executing in
const ( // TeamContext is a context level representing a full team.laforge, build.laforge, env.laforge, base.laforge, and global.laforge= TeamContext StateContext = iota // BuildContext is a context level representing being within an environment's build directory BuildContext // EnvContext is a context level representing a full env.laforge + base.laforge was found EnvContext // BaseContext is a context level representing just a base.laforge was located BaseContext // GlobalContext is a context level representing a valid global configuration was found GlobalContext // NoContext is a context level representing neither a env.laforge or base.laforge was found NoContext )
func (StateContext) String ¶
func (s StateContext) String() string
type Status ¶
type Status struct {
State ProvisionStatus `json:"state"`
StartedAt time.Time `json:"started_at,omitempty"`
EndedAt time.Time `json:"ended_at,omitempty"`
Failed bool `json:"failed"`
Completed bool `json:"completed"`
Error string `json:"error,omitempty"`
}
Status represents the state of an individual object that could be provisioned within a laforge team environment
func (*Status) CanProceed ¶
CanProceed is used to ensure the state allows further traversal
func (*Status) Current ¶
func (s *Status) Current() ProvisionStatus
Current returns the current status
func (Status) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Status) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Status) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Status) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Team ¶
type Team struct {
ID string `hcl:"id,label" json:"id,omitempty"`
TeamNumber int `hcl:"team_number,attr" json:"team_number,omitempty"`
Config map[string]string `hcl:"config,attr" json:"config,omitempty"`
Tags map[string]string `hcl:"tags,attr" json:"tags,omitempty"`
OnConflict *OnConflict `hcl:"on_conflict,block" json:"on_conflict,omitempty"`
Revision int64 `hcl:"revision,attr" json:"revision,omitempty"`
Maintainer *User `hcl:"maintainer,block" json:"maintainer,omitempty"`
ProvisionedNetworks map[string]*ProvisionedNetwork `json:"provisioned_networks"`
ProvisionedHosts map[string]*ProvisionedHost `json:"provisioned_hosts"`
Build *Build `json:"-"`
Environment *Environment `json:"-"`
Competition *Competition `json:"-"`
RelBuildPath string `json:"-"`
TeamRoot string `json:"-"`
Dir string `json:"-"`
Caller Caller `json:"-"`
Runner *runner.Runner `json:"-"`
}
Team represents a team specific object existing within an environment
func (*Team) Associate ¶
Associate attempts to actually draw the relationships on the graph between dependencies
func (*Team) CreateProvisionResources ¶
CreateProvisionResources enumerates the environment's included networks and creates provisioned network objects
func (*Team) CreateProvisionedNetwork ¶
func (t *Team) CreateProvisionedNetwork(net *Network) *ProvisionedNetwork
CreateProvisionedNetwork actually creates the provisioned network object and assigns parent pointers accordingly.
func (*Team) CreateRunner ¶
CreateRunner creates a new local command runner for the team, and returns it
func (*Team) GetOnConflict ¶
func (t *Team) GetOnConflict() OnConflict
GetOnConflict implements the Mergeable interface
func (*Team) LoadFileDeps ¶
func (t *Team) LoadFileDeps(base *Laforge, pr *PathResolver, caller CallFile) error
LoadFileDeps attempts ot load important key material in the team configuration for connecting to remote team hosts
func (*Team) LocateProvisionedHost ¶
func (t *Team) LocateProvisionedHost(netid, hostid string) (*ProvisionedHost, error)
LocateProvisionedHost is used to locate the provisioned host object by specifying a global host and network ID. (useed in dependency traversal)
func (Team) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Team) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Team) ParentLaforgeID ¶
ParentLaforgeID returns the Team's parent build ID
func (*Team) RunLocalCommand ¶
func (t *Team) RunLocalCommand(command string, args []string, wg *sync.WaitGroup, errChan chan error)
RunLocalCommand runs a local command in the team's local directory
func (*Team) RunTerraformCommand ¶
RunTerraformCommand runs terraform subcommands inside a team's local directory
func (*Team) RunTerraformSequence ¶
RunTerraformSequence attempts to run a series of commands on a team
func (*Team) SetOnConflict ¶
func (t *Team) SetOnConflict(o OnConflict)
SetOnConflict implements the Mergeable interface
func (*Team) TerraformInit ¶
TerraformInit runs terraform init for a team
func (*Team) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Team) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (*Team) ValidatePath ¶
ValidatePath implements the Pather interface
type TerraformJob ¶
type TerraformJob struct {
GenericJob
Commands [][]string `json:"commands"`
Target *Team `json:"-"`
OutputCallback OutputCallback `json:"-"`
}
TerraformJob attempts to run one or more terraform commands on the system easyjson:json
func (*TerraformJob) CanProceed ¶
func (j *TerraformJob) CanProceed() error
CanProceed implements the Doer interface
func (*TerraformJob) CleanUp ¶
func (j *TerraformJob) CleanUp() error
CleanUp implements the Doer interface
func (*TerraformJob) EnsureDependencies ¶
func (j *TerraformJob) EnsureDependencies(l *Laforge) error
EnsureDependencies implements the Doer interface
func (*TerraformJob) Finish ¶
func (j *TerraformJob) Finish() error
Finish implements the Doer interface
func (TerraformJob) MarshalEasyJSON ¶
func (v TerraformJob) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TerraformJob) MarshalJSON ¶
func (v TerraformJob) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TerraformJob) UnmarshalEasyJSON ¶
func (v *TerraformJob) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TerraformJob) UnmarshalJSON ¶
func (v *TerraformJob) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type User ¶
type User struct {
ID string `hcl:"id,label" cty:"id" json:"id,omitempty"`
Name string `hcl:"name,attr" cty:"name" json:"name,omitempty"`
UUID string `hcl:"uuid,optional" cty:"uuid" json:"uuid,omitempty"`
Email string `hcl:"email,attr" cty:"email" json:"email,omitempty"`
}
User defines a laforge command line user and their properties
func (User) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (User) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*User) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*User) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type WinRMAuthConfig ¶
type WinRMAuthConfig struct {
RemoteAddr string `hcl:"remote_addr,attr" json:"remote_addr,omitempty"`
Port int `hcl:"port,attr" json:"port,omitempty"`
HTTPS bool `hcl:"https,attr" json:"https,omitempty"`
SkipVerify bool `hcl:"skip_verify,attr" json:"skip_verify,omitempty"`
TLSServerName string `hcl:"tls_server_name,optional" json:"tls_server_name,omitempty"`
CAFile string `hcl:"ca_file,optional" json:"ca_file,omitempty"`
CertFile string `hcl:"cert_file,optional" json:"cert_file,omitempty"`
KeyFile string `hcl:"key_file,optional" json:"key_file,omitempty"`
User string `hcl:"user,attr" json:"user,omitempty"`
Password string `hcl:"password,attr" json:"password,omitempty"`
KeyFileRef *LocalFileRef `json:"-"`
CertFileRef *LocalFileRef `json:"-"`
CAFileRef *LocalFileRef `json:"-"`
}
WinRMAuthConfig defines how Laforge should connect via WinRM to a provisioned host
func (*WinRMAuthConfig) Hash ¶
func (w *WinRMAuthConfig) Hash() uint64
Hash implements the Hasher interface
func (*WinRMAuthConfig) LoadCAFile ¶
func (w *WinRMAuthConfig) LoadCAFile(base *Laforge, pr *PathResolver, caller CallFile) error
LoadCAFile attempts to locate the referenced source file with a laforge base configuration
func (*WinRMAuthConfig) LoadCertFile ¶
func (w *WinRMAuthConfig) LoadCertFile(base *Laforge, pr *PathResolver, caller CallFile) error
LoadCertFile attempts to locate the referenced source file with a laforge base configuration
func (*WinRMAuthConfig) LoadKeyFile ¶
func (w *WinRMAuthConfig) LoadKeyFile(base *Laforge, pr *PathResolver, caller CallFile) error
LoadKeyFile attempts to locate the referenced source file with a laforge base configuration
func (WinRMAuthConfig) MarshalEasyJSON ¶
func (v WinRMAuthConfig) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (WinRMAuthConfig) MarshalJSON ¶
func (v WinRMAuthConfig) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*WinRMAuthConfig) Protocol ¶
func (w *WinRMAuthConfig) Protocol() string
Protocol implements the ShellConfig interface
func (*WinRMAuthConfig) ToUploadConfig ¶
func (w *WinRMAuthConfig) ToUploadConfig() (string, winrmcp.Config)
ToUploadConfig returns the socket and a winrmcp config for uploading via WinRM
func (*WinRMAuthConfig) UnmarshalEasyJSON ¶
func (v *WinRMAuthConfig) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*WinRMAuthConfig) UnmarshalJSON ¶
func (v *WinRMAuthConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type WinRMClient ¶
type WinRMClient struct {
Config *WinRMAuthConfig
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
WinRMClient is a type to connection to Windows hosts remotely over the WinRM protocol
func (*WinRMClient) ExecuteNonInteractive ¶
func (w *WinRMClient) ExecuteNonInteractive(cmd *RemoteCommand) error
ExecuteNonInteractive allows you to execute commands in a non-interactive session (note: standard command shell, not powershell)
func (*WinRMClient) Kind ¶
func (w *WinRMClient) Kind() string
Kind implements the Sheller interface
func (*WinRMClient) LaunchInteractiveShell ¶
func (w *WinRMClient) LaunchInteractiveShell() error
LaunchInteractiveShell implements the Sheller interface
func (*WinRMClient) SetConfig ¶
func (w *WinRMClient) SetConfig(c *WinRMAuthConfig) error
SetConfig implements the Sheller interface
Source Files
¶
- ami.go
- base.go
- build.go
- caller.go
- checksum.go
- command.go
- command_job.go
- competition.go
- config.go
- connection.go
- defaults.go
- dns.go
- dns_record.go
- dns_record_job.go
- environment.go
- filter.go
- finding.go
- generic_job.go
- host.go
- identity.go
- job_manager.go
- json.go
- loader.go
- local.go
- mergeable.go
- metadata.go
- network.go
- path_registry.go
- planner.go
- provision_status.go
- provisioned_host.go
- provisioned_network.go
- provisioner.go
- provisioning_step.go
- remote_command.go
- remote_file.go
- remote_file_job.go
- remote_state.go
- remote_state_config.go
- renderer.go
- revision.go
- script.go
- script_job.go
- shell_config.go
- snapshot.go
- ssh.go
- sshclient_unix.go
- state.go
- status.go
- stdio.go
- team.go
- terraform_job.go
- user.go
- winrm.go