Documentation ¶
Index ¶
- func BuildAddress(packageName, targetType, targetName string) string
- func CreateEvalContext(opts EvalContextOptions) *hcl.EvalContext
- func DockerRunFunc(ctx context.Context, plugin Plugin) function.Function
- func FilterChangeNotificationsByTarget(graph *Graph, root dag.Vertex) rxgo.Predicate
- func KVGet(kvStorage kv.Storage) function.Function
- func LoadConfigFunc(baseDir string) function.Function
- func ReRunOnChange(callback func() error) rxgo.Func
- type Addressable
- type ArtifactsConfig
- type BuildCacheState
- type BuildFile
- type Buildable
- type Cacheable
- type ControlPlaneConfig
- type DecodeRawTargetOpts
- type DecodedBuildFile
- type EvalContextOptions
- type FileSystemConfig
- type Graph
- func (g *Graph) Add(vertex dag.Vertex) dag.Vertex
- func (g *Graph) Connect(src, dest dag.Vertex)
- func (g *Graph) DirectedGraph() dag.AcyclicGraph
- func (g *Graph) Dot() []byte
- func (g *Graph) DotToFile(filename string) error
- func (g *Graph) Isolate(start dag.Vertex) *Graph
- func (g *Graph) MarshalJSON() ([]byte, error)
- func (g *Graph) Roots() []dag.Vertex
- func (g *Graph) String() string
- func (g *Graph) TopologicalSort(start dag.Vertex) []dag.Vertex
- func (g *Graph) TransitiveReduction()
- func (g *Graph) Validate() error
- func (g *Graph) Walk(walk GraphWalker) error
- type GraphWalker
- type Hashable
- type InternalConfig
- type JsonnetConfig
- type KubernetesConfig
- type Locals
- type LookupTable
- func (t LookupTable) Add(target Addressable) error
- func (t LookupTable) BuildGraph() (*Graph, error)
- func (t LookupTable) BuildGraphEdges(graph *Graph, target Target) error
- func (t *LookupTable) BuildTargetDependencies(graph *Graph, addressable Addressable) error
- func (t LookupTable) FilterByPatterns(matcher *pattern.Matcher) (addressables []Addressable)
- func (t LookupTable) FilterSortedAddresses(matcher *pattern.Matcher) (addresses []string)
- func (t LookupTable) Lookup(packageName, targetType, targetName string) (Addressable, error)
- func (t LookupTable) LookupByAddress(address string) (Addressable, error)
- func (t LookupTable) ResolveHCLVariableDependencies(addressable Addressable) []Addressable
- func (t LookupTable) SortedAddresses() []string
- func (t LookupTable) ToCtyVariables() map[string]cty.Value
- type Module
- type Package
- type ParsedAddress
- type Plugin
- type RawComputedAttrs
- type RawTarget
- func (t RawTarget) Address() string
- func (t RawTarget) Artifacts() map[string]string
- func (t RawTarget) ArtifactsDir() string
- func (t RawTarget) Attributes() map[string]cty.Value
- func (t RawTarget) CacheEnabled() bool
- func (t RawTarget) CheckLocalBuildCache() (bool, error)
- func (t RawTarget) CheckRemoteCache() (bool, error)
- func (t *RawTarget) Deps() []string
- func (t RawTarget) Describe() string
- func (t RawTarget) DirRelToWorkspace() string
- func (t *RawTarget) EvaluateHCLExpressions() error
- func (t RawTarget) FileDeps() (*observer.FileMatchCache, bool)
- func (t RawTarget) GetFileMatcher() *pattern.Matcher
- func (t *RawTarget) GetRawTarget() *RawTarget
- func (t *RawTarget) GetStateAttrs() interface{}
- func (t RawTarget) Hash() string
- func (t RawTarget) HashableAttributes() map[string]interface{}
- func (t RawTarget) Hashcode() interface{}
- func (t RawTarget) IsolateHCLBlocks() (*hclwrite.File, error)
- func (t RawTarget) ListLabels() []string
- func (t RawTarget) LoadLocalBuildCacheState() (BuildCacheState, error)
- func (t RawTarget) LocalVars() map[string]cty.Value
- func (t RawTarget) MkArtifactsDir() error
- func (t RawTarget) MkTmpArtifactsDir() error
- func (t RawTarget) PackageDir() string
- func (t RawTarget) PackageName() string
- func (t RawTarget) PackageVersion() string
- func (t *RawTarget) PrevState() state_store.KVStore
- func (t RawTarget) PullRemoteCache() error
- func (t RawTarget) PushRemoteCache() error
- func (t RawTarget) RemoteArtifactKey() string
- func (t RawTarget) SaveLocalBuildCacheState() error
- func (t *RawTarget) SetStateAttrs(v interface{}) interface{}
- func (t RawTarget) ShortHash() string
- func (t RawTarget) SourceFilesList() (sourceFiles []string)
- func (t *RawTarget) State() state_store.KVStore
- func (t RawTarget) StateFilePath() string
- func (t RawTarget) String() string
- func (t RawTarget) TmpArtifactsDir() string
- type Target
- type Targets
- type UserConfig
- type VaultClientFactory
- type VaultConfig
- type Workspace
- func (w *Workspace) ArkDir() string
- func (w *Workspace) ArtifactsDir() string
- func (w Workspace) Attributes() map[string]interface{}
- func (w Workspace) AttributesToCty() map[string]cty.Value
- func (w Workspace) Clean() error
- func (w *Workspace) DecodeBuildFiles() ([]BuildFile, error)
- func (w *Workspace) DecodeFile(eval *hcl.EvalContext) hcl.Diagnostics
- func (w *Workspace) DetermineRoot(startingDir string) error
- func (w *Workspace) DetermineRootFromCWD() error
- func (w *Workspace) DirBase() string
- func (w *Workspace) ExtractCliOptions(cmd *cobra.Command, args []string)
- func (w *Workspace) GraphWalk(address string, walk GraphWalker) error
- func (w *Workspace) InitDockerClient() error
- func (w *Workspace) InitKubeClient(namespace string) error
- func (w *Workspace) InitVaultClient() error
- func (w *Workspace) JsonnetLibrary(ext []string) []string
- func (w *Workspace) K8sSafeContexts() []string
- func (w *Workspace) LoadBuildFiles() ([]string, error)
- func (w *Workspace) LoadTargets(buildFiles []BuildFile) error
- func (w *Workspace) SetEnvironmentConstraint(envFlagValue string)
- func (w *Workspace) WatchForChanges(filter rxgo.Predicate, onChange rxgo.Func) rxgo.Observable
- type WorkspaceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAddress ¶
BuildAddress constructs the target address string from a directory, type, and name
func CreateEvalContext ¶
func CreateEvalContext(opts EvalContextOptions) *hcl.EvalContext
CreateEvalContext creates a new evaluation context intended for use during Buildable.PreBuild
func DockerRunFunc ¶
DockerRunFunc executes a docker exec using a specifically provided image
func FilterChangeNotificationsByTarget ¶
FilterChangeNotificationsByTarget is an rxgo.Predicate to filter a stream by workspace target dependencies
func LoadConfigFunc ¶
LoadConfigFunc loads environment-specific configuration into the HCL context
func ReRunOnChange ¶
func ReRunOnChange(callback func() error) rxgo.Func
ReRunOnChange returns an rxgo.Func that lists the changes made against targets and then executes the provided callback
Types ¶
type Addressable ¶
type Addressable interface { // Address is the string representation of the targets address in the build graph (root.go_binary.tool) Address() string // Describe returns the description of the target defined in the BUILD.hcl file (this is optional, so it can be empty) Describe() string // String is an alias for Address String() string // Hashcode is an alias for Address used to satisfy the hashable interface Hashcode() interface{} // ListLabels returns a string slice of labels on a target ListLabels() []string }
Addressable an interface describing objects which can be addressed
type ArtifactsConfig ¶
type ArtifactsConfig struct {
StorageBaseURL string `hcl:"storage_base_url,attr"`
}
ArtifactsConfig holds data for the storage of artifacts
type BuildCacheState ¶
BuildCacheState provides the structure for the state.json file
type BuildFile ¶
type BuildFile struct { HCL *hcl.File Path string }
BuildFile the parsed hcl file and location on the file system
type Buildable ¶
type Buildable interface { Target Hashable // PreBuild a lifecycle hook that should ALWAYS be called before Build // This is a stateful function that causes target state to be updated prior to a build execution PreBuild() error // Build a function that executes a build for a given target. // If this function succeeds then the build was successful and should have resulted in an artifact. Build() error // Artifacts is a list of declared artifacts names Artifacts() map[string]string // ArtifactsDir is the absolute path to the /ark/artifacts directory of this target ArtifactsDir() string // MkArtifactsDir recursively ensures the ArtifactsDir exists MkArtifactsDir() error }
Buildable represents a an object that can be built and produces artifacts
type Cacheable ¶
type Cacheable interface { // CacheEnabled allows for overriding the default caching behavior on a per-target basis // TODO: Split cacheable functions from raw_target. This is a temporary hack. CacheEnabled() bool // StateFilePath is the path in the artifacts directory to the state.json file for this target StateFilePath() string // CheckLocalBuildCache checks if the local cache contains a copy of the buildable artifacts CheckLocalBuildCache() (bool, error) // LoadLocalBuildCacheState returns the contents of the state.json file at StateFilePath() LoadLocalBuildCacheState() (BuildCacheState, error) // SaveLocalBuildCacheState saves the current state to state.json file at StateFilePath() SaveLocalBuildCacheState() error // CheckRemoteCache checks if the remote cache contains a copy of the buildable artifacts CheckRemoteCache() (bool, error) // PullRemoteCache pulls a copy of the buildable artifacts from the remote cache PullRemoteCache() error // PushRemoteCache pushes a copy of the buildable artifacts to the remote cache PushRemoteCache() error }
Cacheable represents a union type of the Hashable, Buildable, and methods that allow its artifacts to be cached locally and remotely
type ControlPlaneConfig ¶
type ControlPlaneConfig struct { OrgID string `hcl:"org_id,attr"` ProjectID string `hcl:"project_id,attr"` ApiURL string `hcl:"api_url,attr"` EventSinkURL string `hcl:"event_sink_url,attr"` LogSinkURL string `hcl:"log_sink_url,attr"` }
ControlPlaneConfig controls options injected into ark control plane components
type DecodeRawTargetOpts ¶
type DecodeRawTargetOpts struct { HclFile *hcl.File Filename string Workspace *Workspace HclCtx *hcl.EvalContext DecodedBuildFile *DecodedBuildFile MaxDepth int CurrentDepth int }
DecodeRawTargetOpts is a struct of options to pass to DecodeRawTargetsFromHCLFile()
type DecodedBuildFile ¶
type DecodedBuildFile struct { Package *Package `hcl:"package,block"` Locals *Locals `hcl:"locals,block"` RawTargets []*RawTarget `hcl:"target,block"` Modules []*Module `hcl:"module,block"` }
DecodedBuildFile ...
type EvalContextOptions ¶
type EvalContextOptions struct { CurrentTarget Target Package Package TargetLookupTable LookupTable Workspace Workspace DisableLookupTableEvaluation bool }
EvalContextOptions a set of dependencies for a pre build evaluation context
type FileSystemConfig ¶
type FileSystemConfig struct {
Ignore []string `hcl:"ignore,attr"`
}
FileSystemConfig configures the workspace file system observer
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph a directed acyclic graph of build targets
func (*Graph) DirectedGraph ¶
func (g *Graph) DirectedGraph() dag.AcyclicGraph
DirectedGraph returns the internal dag
func (*Graph) MarshalJSON ¶
MarshalJSON marshals the graph as JSON
func (*Graph) TopologicalSort ¶
TopologicalSort of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering This function sorts the vertices by their name to be deterministic.
func (*Graph) TransitiveReduction ¶
func (g *Graph) TransitiveReduction()
TransitiveReduction performs the transitive reduction of graph g in place.
func (*Graph) Walk ¶
func (g *Graph) Walk(walk GraphWalker) error
Walk walks the graph, calling your callback as each node is visited. This will walk nodes in parallel if it can. The resulting diagnostics contains problems from all graphs visited, in no particular order.
type GraphWalker ¶
GraphWalker a callback function used to process targets in the order they should be executed in based on their dependency chain
func BuildWalker ¶
func BuildWalker(force bool, pullFromRemoteCache bool, pushToRemoteCache bool) GraphWalker
BuildWalker walks the graph and builds each target sequentially attempting to cache where possible
type Hashable ¶
type Hashable interface { // Hash a full hex string sha256sum of the buildable // This can be empty if the hash has not been computed and saved in the state store Hash() string // ShortHash a 7 character hex string sha256sum of the buildable // This can be empty if the hash has not been computed and saved in the state store ShortHash() string // HashableAttributes returns a map of attributes that are hashed for the purpose of tracking build configuration changes for a target HashableAttributes() map[string]interface{} }
Hashable an interface describing objects that implement hashing methods
type InternalConfig ¶
type InternalConfig struct {
DisableEntrypointInjection bool `hcl:"disable_entrypoint_injection,optional"`
}
InternalConfig an object which describes arks internal configuration options
type JsonnetConfig ¶
type JsonnetConfig struct {
Library []string `hcl:"library,optional"`
}
JsonnetConfig allows a user to configure overrides for internal systems
type KubernetesConfig ¶
type KubernetesConfig struct {
SafeContexts []string `hcl:"safe_contexts,attr"`
}
KubernetesConfig holds data for applying k8s manifests to clusters
type Locals ¶
Locals represents variables that are constrained to the current package/BUILD.hcl file
type LookupTable ¶
type LookupTable map[string]Addressable
LookupTable (look up table) adds and retrieves targets by their target.Address() LookupTable["src/go/tools/monarch.go_binary:linux"]Addressable
func (LookupTable) Add ¶
func (t LookupTable) Add(target Addressable) error
Add adds a target to the LUT
func (LookupTable) BuildGraph ¶
func (t LookupTable) BuildGraph() (*Graph, error)
BuildGraph returns a graph of all objects in the lookup table
func (LookupTable) BuildGraphEdges ¶
func (t LookupTable) BuildGraphEdges(graph *Graph, target Target) error
BuildGraphEdges takes a graph and a target and attempts to build edges between the target and its dependencies
func (*LookupTable) BuildTargetDependencies ¶
func (t *LookupTable) BuildTargetDependencies(graph *Graph, addressable Addressable) error
BuildTargetDependencies takes a graph and an addressable and attempts to build build onto the graph
func (LookupTable) FilterByPatterns ¶
func (t LookupTable) FilterByPatterns(matcher *pattern.Matcher) (addressables []Addressable)
FilterByPatterns returns a slice of Addressable targets that have been filtered against a slice of glob patterns supplied by the pattern.Matcher
func (LookupTable) FilterSortedAddresses ¶
func (t LookupTable) FilterSortedAddresses(matcher *pattern.Matcher) (addresses []string)
FilterSortedAddresses returns a sorted slice of target addresses that have been filtered against a slice of glob patterns supplied by the pattern.Matcher
func (LookupTable) Lookup ¶
func (t LookupTable) Lookup(packageName, targetType, targetName string) (Addressable, error)
Lookup locates a target by constructing its address This is a convenience function to be used as an hcl eval function and the CLI
func (LookupTable) LookupByAddress ¶
func (t LookupTable) LookupByAddress(address string) (Addressable, error)
LookupByAddress uses a fully qualified address
func (LookupTable) ResolveHCLVariableDependencies ¶
func (t LookupTable) ResolveHCLVariableDependencies(addressable Addressable) []Addressable
ResolveHCLVariableDependencies returns a list of addressables from the lookup table that are referenced as variables in hcl.Expressions This function will panic if you pass a non struct type as it uses reflection to look for HCL expression struct fields
func (LookupTable) SortedAddresses ¶
func (t LookupTable) SortedAddresses() []string
SortedAddresses returns an alphabetical list of addresses
func (LookupTable) ToCtyVariables ¶
func (t LookupTable) ToCtyVariables() map[string]cty.Value
ToCtyVariables returns the lookup table as a deeply nested object for use in hcl.Expressions
type Module ¶
type Module struct { Name string `hcl:",label"` Source hcl.Expression `hcl:"source,attr"` HCL hcl.Body `json:"-" hcl:",remain"` Path string }
Module defines the properties used to create re-usable modules
type Package ¶
type Package struct { Name string `hcl:",label"` Description string `hcl:"description,attr"` Version string `hcl:"version,optional"` Dir string }
Package the package of the give target This is used to build target addressing
type ParsedAddress ¶
ParsedAddress a struct that represents the parts of a parsed address
func ParseAddress ¶
func ParseAddress(address string) (*ParsedAddress, error)
ParseAddress parses an address string and returns an parsed address struct
func (ParsedAddress) String ¶
func (p ParsedAddress) String() string
String returns a string representation of an address
type Plugin ¶
Plugin defines a docker image that can be used as an HCL function the image must take in data from stdin and the output from the plugin is a string
type RawComputedAttrs ¶
type RawComputedAttrs struct { Labels []string `hcl:"labels,optional"` Files []string `hcl:"source_files,optional"` IncludePatterns []string `hcl:"include_patterns,optional"` ExcludePatterns []string `hcl:"exclude_patterns,optional"` }
RawComputedAttrs is a container for hcl expressions that need to be referenced
type RawTarget ¶
type RawTarget struct { // initial pass properties of a target Type string `hcl:",label"` Name string `hcl:",label"` Description *string `hcl:"description,attr"` DependsOn *[]string `hcl:"depends_on,attr"` DeclaredArtifacts *[]string `hcl:"artifacts,attr"` Labels hcl.Expression `hcl:"labels,optional"` SourceFiles hcl.Expression `hcl:"source_files,attr"` IncludePatterns hcl.Expression `hcl:"include_patterns,attr"` ExcludePatterns hcl.Expression `hcl:"exclude_patterns,attr"` // A file matcher used for filtering source files FileMatcher *pattern.Matcher `json:"-"` // the remaining HCL encoded body HCL hcl.Body `json:"-" hcl:",remain"` HCLBytes []byte `json:"-"` // the directory of the BUILD.hcl file Dir string // the BUILD.hcl file this came from File string Package *Package `json:"-"` Workspace *Workspace `json:"-"` Locals *Locals `json:"-"` // State Management StateStore *state_store.StateStore RawComputedAttrs *RawComputedAttrs Module *Module }
RawTarget a data container for the initial decoding pass
func DecodeRawTargetsFromHCLFile ¶
func DecodeRawTargetsFromHCLFile(opts DecodeRawTargetOpts) ([]*RawTarget, hcl.Diagnostics)
DecodeRawTargetsFromHCLFile returns a slice of RawTarget pointers after the initial decoding pass
func (RawTarget) ArtifactsDir ¶
ArtifactsDir returns the file path to the artifacts directory
func (RawTarget) Attributes ¶
Attributes a map of attributes for use in hcl.EvalContexts
func (RawTarget) CacheEnabled ¶
CacheEnabled returns true to cache targets by default. Can be overridden on a per-target basis
func (RawTarget) CheckLocalBuildCache ¶
CheckLocalBuildCache loads the build cache state and verifies that the hashes match
func (RawTarget) CheckRemoteCache ¶
CheckRemoteCache determines whether an artifact for a given target exists in remote storage
func (RawTarget) DirRelToWorkspace ¶
DirRelToWorkspace the target's directory relative to the workspace root
func (*RawTarget) EvaluateHCLExpressions ¶
EvaluateHCLExpressions evaluates the source_files, include_patterns, and exclude patterns of the target
func (RawTarget) FileDeps ¶
func (t RawTarget) FileDeps() (*observer.FileMatchCache, bool)
FileDeps returns an observer file match cache
func (RawTarget) GetFileMatcher ¶
GetFileMatcher returns the FileMatcher on the RawTarget used in the Buildable interface
func (*RawTarget) GetRawTarget ¶
GetRawTarget returns the RawTarget
func (*RawTarget) GetStateAttrs ¶
func (t *RawTarget) GetStateAttrs() interface{}
GetStateAttrs returns the stored computed attrs
func (RawTarget) Hash ¶
Hash returns a hex formatted sha256 hash of the sources and dependencies If the hash is a zero hash we panic
func (RawTarget) HashableAttributes ¶
HashableAttributes returns a map of attributes that are hashed for the purpose of tracking build configuration changes for a target Deprecated
func (RawTarget) Hashcode ¶
func (t RawTarget) Hashcode() interface{}
Hashcode an interface used as a key by the DAG lib
func (RawTarget) IsolateHCLBlocks ¶
IsolateHCLBlocks uses the targets source bytes to isolate its original HCL form (convenient for rewriting or hashing)
func (RawTarget) ListLabels ¶
ListLabels returns a string slice of labels on a target
func (RawTarget) LoadLocalBuildCacheState ¶
func (t RawTarget) LoadLocalBuildCacheState() (BuildCacheState, error)
LoadLocalBuildCacheState decodes the local build cache state file for the specified target
func (RawTarget) LocalVars ¶
LocalVars returns a map of variables local to the package for use in hcl.EvalContexts
func (RawTarget) MkArtifactsDir ¶
MkArtifactsDir creates the artifacts directory
func (RawTarget) MkTmpArtifactsDir ¶
MkTmpArtifactsDir creates the artifacts directory in os.TempDir()
func (RawTarget) PackageDir ¶
PackageDir is the absolute path of the directory of a target
func (RawTarget) PackageName ¶
PackageName returns the string value of package.Name
func (RawTarget) PackageVersion ¶
PackageVersion returns the string value of package.Version
func (*RawTarget) PrevState ¶
func (t *RawTarget) PrevState() state_store.KVStore
PrevState return the previous state from the state store
func (RawTarget) PullRemoteCache ¶
PullRemoteCache pulls an artifact from remote storage that matches a target's state hash and loads it for local use
func (RawTarget) PushRemoteCache ¶
PushRemoteCache archives and compresses an artifact and pushes the artifact into remote storage
func (RawTarget) RemoteArtifactKey ¶
RemoteArtifactKey constructs a string path for a remote artifact
func (RawTarget) SaveLocalBuildCacheState ¶
SaveLocalBuildCacheState saves a new instance of BuildCacheState as JSON to t.StateFilePath()
func (*RawTarget) SetStateAttrs ¶
func (t *RawTarget) SetStateAttrs(v interface{}) interface{}
SetStateAttrs updates the attrsStateKey in the state store
func (RawTarget) ShortHash ¶
ShortHash the first 7 characters of the calculated hash of the sources and dependencies
func (RawTarget) SourceFilesList ¶
SourceFilesList returns a string slice of source files
func (*RawTarget) State ¶
func (t *RawTarget) State() state_store.KVStore
State return the current state from the state store
func (RawTarget) StateFilePath ¶
StateFilePath returns a string path to the state file for the target
func (RawTarget) TmpArtifactsDir ¶
TmpArtifactsDir returns an artifacts directory in the os.TempDir()
type Target ¶
type Target interface { Addressable // Deps is a static list of ancestor target addresses declared in the BUILD.hcl file (this can be empty) Deps() []string // FileDeps returns an observer file match cache FileDeps() (*observer.FileMatchCache, bool) // State is a KV state store for caching data about the buildable target State() state_store.KVStore // PrevState is a secondary state store intended for comparing current state to previously known state PrevState() state_store.KVStore // LocalVars are a list of cty values used to keep HCL dry LocalVars() map[string]cty.Value // Attributes are a static list of cty values to be used in HCL EvaluationContexts Attributes() map[string]cty.Value // DirRelToWorkspace is the directory of target relative to its workspace // This is typically the location of the HCL file the target was declared in DirRelToWorkspace() string // EvaluateHCLExpressions evaluate source_files, include_patters, and exclude_patterns as expressions EvaluateHCLExpressions() error // PackageName returns the string value of package.Name PackageName() string // PackageVersion returns the string value of package.Version PackageVersion() string // PackageDir is the absolute path of the directory of a target PackageDir() string GetRawTarget() *RawTarget }
Target represents the base interface for all targets which must also be Addressable
type Targets ¶
Targets is a map of types to their target interfaces Targets["exec"]emptyExampleExecTarget{}
func (Targets) MapRawTargets ¶
MapRawTargets reflects against an internal map of buildable target types constructs a new copy of the target type in its memory, decodes the remaining rawTarget HCL into the new copy of the mapped target and embeds the rawTarget in the mappedTarget
if there is no target type for the rawTarget.Type an error will be raised if the mapped target cannot be converted into a pointer an error will be raised if the mapped target cannot be cast back into the target interface an error will be raised.
type UserConfig ¶
type UserConfig struct {
Token string `hcl:"address,attr"`
}
UserConfig used to authenticate users of the ark control plane
type VaultClientFactory ¶
VaultClientFactory allows for the injection of a custom configured Vault client
type VaultConfig ¶
type VaultConfig struct { Address string `hcl:"address,attr"` EncryptionKey string `hcl:"encryption_key,optional"` }
VaultConfig allows user to set Vault address that's not reliant on an env var
type Workspace ¶
type Workspace struct { Dir string File string HCL hcl.Body `json:"-"` TargetWatch bool TargetGraph Graph RegisteredTargets Targets TargetLUT LookupTable Observer *observer.Observer Config WorkspaceConfig Context context.Context K8s kube.Client Vault *vault.Client Docker *container.Docker KVStorage kv.Storage Cmd *cobra.Command Args []string PassableArgs []string DefaultJsonnetLibrary []string PortBinderCommands portbinder.CommandChannel ReadyPortCommands portbinder.CommandChannel ConfigurationEnvironment string VaultClientFactory VaultClientFactory }
Workspace the workspace configuration for ark
func (*Workspace) ArtifactsDir ¶
ArtifactsDir returns the .ark/artifacts directory relative to the workspace root
func (Workspace) Attributes ¶
Attributes of this workspace, intended to be used in hcl.EvalContext.
func (Workspace) AttributesToCty ¶
AttributesToCty returns the workspace attributes as cty values
func (Workspace) Clean ¶
Clean removes generated files from the /ark/artifacts directory this is used to reset the local state and artifacts cache
func (*Workspace) DecodeBuildFiles ¶
DecodeBuildFiles loads build files from the workspace and decodes them into build file structs.
func (*Workspace) DecodeFile ¶
func (w *Workspace) DecodeFile(eval *hcl.EvalContext) hcl.Diagnostics
DecodeFile decodes the workspace file into the workspace configuration struct
func (*Workspace) DetermineRoot ¶
DetermineRoot recursively searches the current directory and all its parents for a WORKSPACE.hcl file
func (*Workspace) DetermineRootFromCWD ¶
DetermineRootFromCWD determine the workspace root from the current working directory
func (*Workspace) DirBase ¶
DirBase returns the basedir of the workspace instead of the absolute path
func (*Workspace) ExtractCliOptions ¶
ExtractCliOptions gets all of the info passed in from the CLI
func (*Workspace) GraphWalk ¶
func (w *Workspace) GraphWalk(address string, walk GraphWalker) error
GraphWalk walks the graph, calling your callback as each node is visited. This will walk nodes in parallel if it can. The resulting diagnostics contains problems from all graphs visited, in no particular order.
func (*Workspace) InitDockerClient ¶
InitDockerClient creates a docker client on the workspace
func (*Workspace) InitKubeClient ¶
InitKubeClient initializes a new kubernetes client set
func (*Workspace) InitVaultClient ¶
InitVaultClient initializes a new Vault client
func (*Workspace) JsonnetLibrary ¶
JsonnetLibrary returns a list of paths to jsonnet libraries
func (*Workspace) K8sSafeContexts ¶
K8sSafeContexts return a slice of k8s safe contexts
func (*Workspace) LoadBuildFiles ¶
LoadBuildFiles walks the workspace root, and it's children for BUILD.hcl files
func (*Workspace) LoadTargets ¶
LoadTargets - loads all build files in the workspace - attempts to decode targets into their respective types - loads targets into the graph, and the look up table - iterates over all loaded targets to build graph edges - validates the graph for cycles and errors
func (*Workspace) SetEnvironmentConstraint ¶
SetEnvironmentConstraint sets the environment constraint from the CLI flag for the purpose of configuration loading
func (*Workspace) WatchForChanges ¶
func (w *Workspace) WatchForChanges(filter rxgo.Predicate, onChange rxgo.Func) rxgo.Observable
WatchForChanges creates a fs observer subscription to the workspace observing changes to the root target
type WorkspaceConfig ¶
type WorkspaceConfig struct { K8s *KubernetesConfig `hcl:"kubernetes,block"` Vault *VaultConfig `hcl:"vault,block"` Artifacts *ArtifactsConfig `hcl:"artifacts,block"` FileSystem *FileSystemConfig `hcl:"file_system,block"` Jsonnet *JsonnetConfig `hcl:"jsonnet,block"` Plugins []Plugin `hcl:"plugin,block"` ControlPlane *ControlPlaneConfig `hcl:"control_plane,block"` User *UserConfig `hcl:"user,block"` Internal *InternalConfig `hcl:"internal,block"` VersionCheckDisabled *bool `hcl:"disable_version_check,attr"` }
WorkspaceConfig holds data for configuring a workspace
func (WorkspaceConfig) K8sConfig ¶
func (w WorkspaceConfig) K8sConfig() *KubernetesConfig
K8sConfig performs a nil check on w.K8s and returns a pointer to a k8s config