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 Definition
- 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) Notify()
- func (m *Manager) ProcessNext(ctx context.Context) (bool, error)
- func (m *Manager) Run(ctx context.Context) error
- func (m *Manager) SyncProject(ctx context.Context, projectID string) ([]store.Workflow, error)
- type Option
- type Provider
- type SecretResolver
- type StepDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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"`
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 JobDefinition ¶
type JobDefinition struct {
Key string `json:"key"`
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"`
AllowFailure bool `json:"allowFailure"`
TimeoutMinutes int `json:"timeoutMinutes,omitempty"`
RollbackCommand string `json:"rollbackCommand,omitempty"`
VerifyCommand string `json:"verifyCommand,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) 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) 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 Option ¶
type Option func(*Manager)
func WithSecretResolver ¶
func WithSecretResolver(resolver SecretResolver) Option
func WithWorkspaceRoot ¶
type Provider ¶
type Provider string
Provider identifies the CI provider that produced a Definition.
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"`
}
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.