Help us shape the future of Go! Take the 2026 Go Developer Survey

taskgraph

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOT

type DOT struct {
	Name   string
	Edges  []string
	Format string
}

func (*DOT) String

func (d *DOT) String() string

String converts a DOT graph to a string

type FormatFuncType

type FormatFuncType func(graph *TaskGraph, format string, withTaskRef bool) (string, error)

FormatFunc is a function that generates the output format string for a TaskGraph

var FormatFunc FormatFuncType = func(graph *TaskGraph, format string, withTaskRef bool) (string, error) {
	switch strings.ToLower(format) {
	case "dot":
		if withTaskRef {
			return graph.ToDOTWithTaskRef().String(), nil
		}
		return graph.ToDOT().String(), nil
	case "puml":
		if withTaskRef {
			return graph.ToPlantUMLWithTaskRef(), nil
		}
		return graph.ToPlantUML(), nil
	case "mmd":
		if withTaskRef {
			return graph.ToMermaidWithTaskRef(), nil
		}
		return graph.ToMermaid(), nil
	default:
		return "", fmt.Errorf("Invalid output format: %s", format)
	}
}

formatFunc generates the output format string for a TaskGraph based on the specified format

type TaskGraph

type TaskGraph struct {
	PipelineName string
	Nodes        map[string]*TaskNode
}

func BuildTaskGraph

func BuildTaskGraph(tasks []v1pipeline.PipelineTask) *TaskGraph

In the case where the order of tasks is arbitrary, it is necessary to create all the nodes first and then add the dependencies in a separate loop (since dependencies doesn't exist in TaskRef). BuildTaskGraph creates a TaskGraph from a list of PipelineTasks

func (*TaskGraph) ToDOT

func (g *TaskGraph) ToDOT() *DOT

ToDOT converts a TaskGraph to a DOT graph

func (*TaskGraph) ToDOTWithTaskRef

func (g *TaskGraph) ToDOTWithTaskRef() *DOT

ToDOTWithTaskRef converts a TaskGraph to a DOT graph

func (*TaskGraph) ToMermaid

func (g *TaskGraph) ToMermaid() string

ToMermaid converts a TaskGraph to a mermaid graph

func (*TaskGraph) ToMermaidWithTaskRef

func (g *TaskGraph) ToMermaidWithTaskRef() string

ToMermaidWithTaskRef converts a TaskGraph to a mermaid graph with taskRefName

func (*TaskGraph) ToPlantUML

func (g *TaskGraph) ToPlantUML() string

ToPlantUML converts a TaskGraph to a PlantUML graph

func (*TaskGraph) ToPlantUMLWithTaskRef

func (g *TaskGraph) ToPlantUMLWithTaskRef() string

ToPlantUMLWithTaskRef converts a TaskGraph to a PlantUML graph with taskRefName

type TaskNode

type TaskNode struct {
	Name         string
	TaskRefName  string // Name of the kind: Task referenced by this task in the pipeline
	Dependencies []*TaskNode
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL