Documentation
¶
Overview ¶
Package execution discovers normalized CI definitions from registered local projects. It intentionally accepts store project records instead of arbitrary filesystem roots so callers cannot expand the service's discovery boundary.
Index ¶
- type ConcurrencyDefinition
- type Definition
- type ErrRunnerUnavailable
- type JobDefinition
- type Manager
- func (m *Manager) EnqueueDeploymentRollback(ctx context.Context, params store.EnqueueRollbackParams) (store.Run, error)
- func (m *Manager) EnqueueRunReplay(ctx context.Context, params store.EnqueueReplayParams) (store.Run, error)
- func (m *Manager) EnqueueTriggered(ctx context.Context, workflowID, ref, commitSHA, trigger string) (store.Run, error)
- func (m *Manager) EnqueueWorkflow(ctx context.Context, workflowID, ref, commitSHA string) (store.Run, error)
- func (m *Manager) EnqueueWorkflowWithInputs(ctx context.Context, workflowID, ref, commitSHA string, ...) (store.Run, error)
- func (m *Manager) Notify()
- func (m *Manager) OpenRunArtifact(ctx context.Context, runID, artifactID string) (store.Artifact, *os.File, error)
- func (m *Manager) ProcessNext(ctx context.Context) (bool, error)
- func (m *Manager) Run(ctx context.Context) error
- func (m *Manager) RunnerInventory() runnerinventory.Inventory
- func (m *Manager) SyncProject(ctx context.Context, projectID string) ([]store.Workflow, error)
- type OnlyExceptDefinition
- type Option
- type Provider
- type RuleDefinition
- type SecretResolver
- type StepDefinition
- type UnavailableRunnerJob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrencyDefinition ¶ added in v0.6.0
type Definition ¶
type Definition struct {
Key string `json:"key"`
ProjectID string `json:"projectId,omitempty"`
ProjectSlug string `json:"projectSlug,omitempty"`
ProjectPath string `json:"projectPath"`
Provider Provider `json:"provider"`
File string `json:"file"`
Name string `json:"name"`
Environment map[string]string `json:"environment"`
Stages []string `json:"stages"`
Triggers []string `json:"triggers"`
TriggerPolicies []triggerpolicy.Policy `json:"triggerPolicies,omitempty"`
Concurrency *ConcurrencyDefinition `json:"concurrency,omitempty"`
Jobs []JobDefinition `json:"jobs"`
TopologicalOrder []string `json:"topologicalOrder"`
}
Definition is a provider-neutral workflow definition ready to be stored by a control plane. File is always a slash-separated path relative to ProjectPath, while Key is stable for a registered project and source file.
func Discover ¶
func Discover(projects []store.Project) ([]Definition, error)
Discover discovers GitHub Actions and GitLab CI definitions from the canonical local paths stored on registered projects. Projects without a CanonicalPath are intentionally skipped: remote-only records are not a filesystem discovery target.
Results are sorted by canonical project path, source file, and provider. Workflow files are checked before parsing, so symlinked paths and paths outside a registered project never reach a provider parser.
func DiscoverProject ¶
func DiscoverProject(project store.Project) ([]Definition, error)
DiscoverProject is the single-project form of Discover. It has the same canonical-path and workflow-path safety guarantees.
type ErrRunnerUnavailable ¶ added in v0.11.0
type ErrRunnerUnavailable struct {
}
func (*ErrRunnerUnavailable) Error ¶ added in v0.11.0
func (err *ErrRunnerUnavailable) Error() string
type JobDefinition ¶
type JobDefinition struct {
Key string `json:"key"`
SourceKey string `json:"sourceKey,omitempty"`
Name string `json:"name"`
Environment map[string]string `json:"environment"`
EnvironmentName string `json:"environmentName,omitempty"`
DeploymentTier string `json:"deploymentTier,omitempty"`
Needs []string `json:"needs"`
Requires []string `json:"requires"`
Stage string `json:"stage,omitempty"`
RunnerHint string `json:"runnerHint,omitempty"`
RunnerRequirements []string `json:"runnerRequirements,omitempty"`
RunnerGroup string `json:"runnerGroup,omitempty"`
RunnerMatch runnerinventory.Match `json:"runnerMatch"`
AllowFailure bool `json:"allowFailure"`
TimeoutMinutes int `json:"timeoutMinutes,omitempty"`
RollbackCommand string `json:"rollbackCommand,omitempty"`
VerifyCommand string `json:"verifyCommand,omitempty"`
Matrix map[string]string `json:"matrix,omitempty"`
MatrixIndex int `json:"matrixIndex,omitempty"`
MatrixTotal int `json:"matrixTotal,omitempty"`
MatrixLabel string `json:"matrixLabel,omitempty"`
Condition executionsemantics.ConditionContract `json:"condition"`
Rules []RuleDefinition `json:"rules,omitempty"`
Only *OnlyExceptDefinition `json:"only,omitempty"`
Except *OnlyExceptDefinition `json:"except,omitempty"`
When string `json:"when,omitempty"`
Concurrency *ConcurrencyDefinition `json:"concurrency,omitempty"`
Interruptible bool `json:"interruptible,omitempty"`
FailFast bool `json:"failFast,omitempty"`
MaxParallel int `json:"maxParallel,omitempty"`
WorkflowCall *types.WorkflowCall `json:"workflowCall,omitempty"`
Container *types.Container `json:"container,omitempty"`
Services map[string]*types.Service `json:"services,omitempty"`
Artifacts *types.ArtifactConfig `json:"artifacts,omitempty"`
Cache *types.CacheConfig `json:"cache,omitempty"`
Steps []StepDefinition `json:"steps"`
}
JobDefinition is a provider-neutral, persistence-ready job. Key is the source job identifier; Needs and Requires therefore reference keys rather than presentation names.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns workflow synchronization, immutable run creation, and one local execution worker. The registered project path is snapshotted before a run enters the queue; workers never accept arbitrary paths or commands from HTTP requests.
func (*Manager) EnqueueDeploymentRollback ¶
func (*Manager) EnqueueRunReplay ¶
func (*Manager) EnqueueTriggered ¶
func (*Manager) EnqueueWorkflow ¶
func (m *Manager) EnqueueWorkflow(ctx context.Context, workflowID, ref, commitSHA string) (store.Run, error)
EnqueueWorkflow creates a complete immutable run graph from the currently active stored workflow definition.
func (*Manager) EnqueueWorkflowWithInputs ¶ added in v0.6.0
func (*Manager) OpenRunArtifact ¶ added in v0.7.0
func (*Manager) ProcessNext ¶
ProcessNext claims and executes at most one queued run. It is public to make deterministic service integration tests possible without timing sleeps.
func (*Manager) RunnerInventory ¶ added in v0.11.0
func (m *Manager) RunnerInventory() runnerinventory.Inventory
func (*Manager) SyncProject ¶
SyncProject discovers provider files beneath one registered project and makes that exact set active. Removed definitions stay stored but inactive so historical runs retain their workflow foreign key.
type OnlyExceptDefinition ¶ added in v0.6.0
type Option ¶
type Option func(*Manager)
func WithDataRoot ¶ added in v0.7.0
func WithRunnerInventory ¶ added in v0.11.0
func WithRunnerInventory(inventory runnerinventory.Inventory) Option
func WithSecretResolver ¶
func WithSecretResolver(resolver SecretResolver) Option
func WithWorkspaceRoot ¶
type Provider ¶
type Provider string
Provider identifies the CI provider that produced a Definition.
type RuleDefinition ¶ added in v0.6.0
type RuleDefinition struct {
Condition executionsemantics.ConditionContract `json:"condition"`
When string `json:"when,omitempty"`
Changes []string `json:"changes,omitempty"`
Exists []string `json:"exists,omitempty"`
Variables map[string]string `json:"variables,omitempty"`
AllowFailure bool `json:"allowFailure,omitempty"`
}
type SecretResolver ¶
type StepDefinition ¶
type StepDefinition struct {
Key string `json:"key"`
Name string `json:"name"`
Command string `json:"command,omitempty"`
Action string `json:"action,omitempty"`
Environment map[string]string `json:"environment"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
TimeoutMinutes int `json:"timeoutMinutes,omitempty"`
Shell string `json:"shell,omitempty"`
AllowFailure bool `json:"allowFailure"`
Condition executionsemantics.ConditionContract `json:"condition"`
Inputs map[string]string `json:"inputs,omitempty"`
Artifacts *types.ArtifactConfig `json:"artifacts,omitempty"`
Cache *types.CacheConfig `json:"cache,omitempty"`
}
StepDefinition is a provider-neutral, persistence-ready execution step. Command holds the shell/script command when available; Action preserves a provider action reference such as actions/checkout@v4.
type UnavailableRunnerJob ¶ added in v0.11.0
type UnavailableRunnerJob struct {
}