Documentation
¶
Index ¶
- Constants
- type ExecutionGraph
- func (g *ExecutionGraph) AddEdge(from string, to string) error
- func (g *ExecutionGraph) AddNode(name string, stage *Stage)
- func (g *ExecutionGraph) AddStage(stage *Stage) error
- func (g *ExecutionGraph) Error() error
- func (g *ExecutionGraph) From(name string) []string
- func (g *ExecutionGraph) Node(name string) (*Stage, error)
- func (g *ExecutionGraph) Nodes() map[string]*Stage
- func (g *ExecutionGraph) To(name string) []string
- type Scheduler
- type Stage
Examples ¶
Constants ¶
View Source
const ( StatusWaiting = iota StatusRunning StatusSkipped StatusDone StatusError StatusCanceled )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutionGraph ¶
func NewExecutionGraph ¶
func NewExecutionGraph(stages ...*Stage) (*ExecutionGraph, error)
func (*ExecutionGraph) AddNode ¶
func (g *ExecutionGraph) AddNode(name string, stage *Stage)
func (*ExecutionGraph) AddStage ¶
func (g *ExecutionGraph) AddStage(stage *Stage) error
func (*ExecutionGraph) Error ¶
func (g *ExecutionGraph) Error() error
func (*ExecutionGraph) From ¶
func (g *ExecutionGraph) From(name string) []string
func (*ExecutionGraph) Nodes ¶
func (g *ExecutionGraph) Nodes() map[string]*Stage
func (*ExecutionGraph) To ¶
func (g *ExecutionGraph) To(name string) []string
type Scheduler ¶
func NewScheduler ¶
func (*Scheduler) Schedule ¶
func (s *Scheduler) Schedule(g *ExecutionGraph) error
Example ¶
format := task.FromCommands("go fmt ./...")
build := task.FromCommands("go build ./..")
r, _ := runner.NewTaskRunner()
s := NewScheduler(r)
graph, err := NewExecutionGraph(
&Stage{Name: "format", Task: format},
&Stage{Name: "build", Task: build, DependsOn: []string{"format"}},
)
if err != nil {
return
}
err = s.Schedule(graph)
if err != nil {
fmt.Println(err)
}
type Stage ¶
type Stage struct {
Name string
Condition string
Task *task.Task
Pipeline *ExecutionGraph
DependsOn []string
Dir string
AllowFailure bool
Status int32
Env variables.Container
Variables variables.Container
Start time.Time
End time.Time
}
func (*Stage) ReadStatus ¶
func (*Stage) UpdateStatus ¶
Click to show internal directories.
Click to hide internal directories.