1package models
2
3import (
4 "context"
5 "time"
6
7 "tangled.org/core/api/tangled"
8 "tangled.org/core/spindle/secrets"
9)
10
11type Engine interface {
12 // NewWorkflowSchema returns an empty schema struct that will be used to unmarshal
13 // the workflow YAML. This allows each engine to define its own YAML structure
14 // with engine-specific fields (e.g., dependencies for nixery, image/architecture for k8s).
15 NewWorkflowSchema() interface{}
16
17 // InitWorkflow is called after the workflow has been parsed and initial steps created.
18 // Engines should use this to:
19 // - Extract their schema from wf.Data
20 // - Prepend any setup steps (e.g., clone, dependency installation)
21 // - Transform or replace steps if needed
22 // - Store final metadata in wf.Data for use in SetupWorkflow
23 InitWorkflow(wf *Workflow, tpl tangled.Pipeline) error
24
25 SetupWorkflow(ctx context.Context, wid WorkflowId, wf *Workflow) error
26 WorkflowTimeout() time.Duration
27 DestroyWorkflow(ctx context.Context, wid WorkflowId) error
28 RunStep(ctx context.Context, wid WorkflowId, w *Workflow, idx int, secrets []secrets.UnlockedSecret, wfLogger *WorkflowLogger) error
29}