Documentation
¶
Index ¶
Constants ¶
const ( TIMESTAMP_FORMAT = "20060102T150405" ProjectTagKey = "project" DefaultProjectID = "default-project" )
Variables ¶
This section is empty.
Functions ¶
func MergeEnvVars ¶
MergeEnvVars merges multiple environment variable maps in priority order. Later maps override earlier ones. Nil maps are skipped.
func ResolveProjectID ¶
func ResolveProjectID(explicit string, wfCfg *WorkflowConfig, submitParams *SubmitParams) string
ResolveProjectID applies the project-context precedence used by runtime templates: explicit token/request value, submit override, workflow config, then the neutral default.
Types ¶
type ContextOption ¶
type ContextOption func(*contextOptions)
ContextOption configures NewWorkflowContext.
func WithBaseDir ¶
func WithBaseDir(dir string) ContextOption
WithBaseDir sets the root directory under which run directories are created. Defaults to "factory/runs".
func WithTimestamp ¶
func WithTimestamp(t time.Time) ContextOption
WithTimestamp overrides the timestamp used for the run directory name. Useful for deterministic testing.
type FactoryContext ¶
type FactoryContext struct {
FactoryDirectory string `json:"workflow_id"`
WorkDirectory string `json:"work_directory"`
EnvVars map[string]string `json:"env_vars"`
ArtifactDir string `json:"artifact_directory"`
ProjectID string `json:"project_id,omitempty"`
}
FactoryContext is the shared execution environment passed to workers. It provides filesystem paths, environment variables, and identifiers that workers need to interact with the execution environment.
func NewFactoryContext ¶
func NewFactoryContext( workflowID string, factoryEnv map[string]string, wfCfg *WorkflowConfig, submitParams *SubmitParams, opts ...ContextOption, ) (*FactoryContext, error)
NewFactoryContext creates a WorkflowContext for a workflow instance. It sets up the run directory structure, merges environment variables from factory, workflow, and submission levels, and optionally creates a git worktree.
type SubmitParams ¶
type SubmitParams struct {
EnvVars map[string]string `json:"env_vars"`
Project string `json:"project,omitempty" yaml:"project,omitempty"`
}
SubmitParams holds per-submission overrides provided when submitting work to the factory. These are merged last (highest priority) into the WorkflowContext.
type WorkflowConfig ¶
type WorkflowConfig struct {
EnvVars map[string]string `json:"env_vars" yaml:"env_vars"`
Project string `json:"project,omitempty" yaml:"project,omitempty"`
}
WorkflowConfig holds workflow-level configuration used when creating a WorkflowContext. It captures settings from the workflow definition that affect the execution environment.