graph

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultNetworkName is the default network name.
	DefaultNetworkName = "acb_default_network"
)
View Source
const (
	// ImmediateExecutionToken defines the when dependency to indicate a step should execute immediately.
	ImmediateExecutionToken = "-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dag

type Dag struct {
	Root  *Node
	Nodes map[string]*Node
	// contains filtered or unexported fields
}

Dag represents a thread safe directed acyclic graph.

func NewDag

func NewDag() *Dag

NewDag creates a new Dag with a root vertex.

func NewDagFromTask added in v1.0.5

func NewDagFromTask(t *Task) (*Dag, error)

NewDagFromTask creates a new Dag based on the specified Task.

func (*Dag) AddEdge

func (d *Dag) AddEdge(from string, to string) error

AddEdge adds an edge between from and to.

func (*Dag) AddVertex

func (d *Dag) AddVertex(value *Step) (*Node, error)

AddVertex adds a vertex to the Dag with the specified name and value.

func (*Dag) RemoveEdge

func (d *Dag) RemoveEdge(from string, to string) error

RemoveEdge removes the edge between from and to.

type Network added in v1.0.7

type Network struct {
	Name         string `yaml:"name"`
	Ipv6         bool   `yaml:"ipv6"`
	Driver       string `yaml:"driver"`
	SkipCreation bool   `yaml:"skipCreation"`
	IsDefault    bool   `yaml:"isDefault"`
}

Network defines a Docker network.

func NewNetwork added in v1.0.7

func NewNetwork(name string, ipv6 bool, driver string, skipCreation bool, isDefault bool) *Network

NewNetwork creates a new network.

func (*Network) Create added in v1.0.7

func (n *Network) Create(ctx context.Context, pm *procmanager.ProcManager) (string, error)

Create creates a new Docker network.

func (*Network) Delete added in v1.0.7

func (n *Network) Delete(ctx context.Context, pm *procmanager.ProcManager) (string, error)

Delete deletes the Docker network.

type Node

type Node struct {
	Name  string
	Value *Step
	// contains filtered or unexported fields
}

Node represents a vertex in a Dag.

func NewNode

func NewNode(value *Step) *Node

NewNode creates a new Node based on the provided name and value.

func (*Node) Children

func (n *Node) Children() []*Node

Children returns the node's children.

func (*Node) GetDegree

func (n *Node) GetDegree() int

GetDegree returns the degree of the node.

type Secret

type Secret struct {
	Akv       string `yaml:"akv,omitempty"`
	SecretEnv string `yaml:"secretEnv,omitempty"`
}

Secret defines a wrapper to translate Azure Key Vault secrets to environment variables.

type SelfReferencedStepError

type SelfReferencedStepError struct {
	// contains filtered or unexported fields
}

SelfReferencedStepError defines an error to be returned if the Step is self-referenced.

func NewSelfReferencedStepError

func NewSelfReferencedStepError(message string) *SelfReferencedStepError

NewSelfReferencedStepError creates a new SelfReferencedStepError with the specified message.

func (*SelfReferencedStepError) Error

func (e *SelfReferencedStepError) Error() string

Error returns the error message for a SelfReferencedStepError.

type Step

type Step struct {
	ID                              string   `yaml:"id"`
	Cmd                             string   `yaml:"cmd"`
	Build                           string   `yaml:"build"`
	Push                            []string `yaml:"push"`
	WorkingDirectory                string   `yaml:"workingDirectory"`
	EntryPoint                      string   `yaml:"entryPoint"`
	Envs                            []string `yaml:"env"`
	SecretEnvs                      []string `yaml:"secretEnvs"`
	Expose                          []string `yaml:"expose"`
	Ports                           []string `yaml:"ports"`
	When                            []string `yaml:"when"`
	ExitedWith                      []int    `yaml:"exitedWith"`
	ExitedWithout                   []int    `yaml:"exitedWithout"`
	Timeout                         int      `yaml:"timeout"`
	Keep                            bool     `yaml:"keep"`
	Detach                          bool     `yaml:"detach"`
	StartDelay                      int      `yaml:"startDelay"`
	Privileged                      bool     `yaml:"privileged"`
	User                            string   `yaml:"user"`
	Network                         string   `yaml:"network"`
	Isolation                       string   `yaml:"isolation"`
	IgnoreErrors                    bool     `yaml:"ignoreErrors"`
	Retries                         int      `yaml:"retries"`
	RetryDelayInSeconds             int      `yaml:"retryDelay"`
	DisableWorkingDirectoryOverride bool     `yaml:"disableWorkingDirectoryOverride"`

	StartTime  time.Time
	EndTime    time.Time
	StepStatus StepStatus

	// CompletedChan can be used to signal to readers
	// that the step has been processed.
	CompletedChan chan bool

	ImageDependencies []*image.Dependencies
	Tags              []string
	BuildArgs         []string
}

Step is a step in the execution task.

func (*Step) Equals

func (s *Step) Equals(t *Step) bool

Equals determines whether or not two steps are equal.

func (*Step) HasNoWhen

func (s *Step) HasNoWhen() bool

HasNoWhen returns true if the Step has no when clause, false otherwise.

func (*Step) IsBuildStep

func (s *Step) IsBuildStep() bool

IsBuildStep returns true if the Step is a build step, false otherwise.

func (*Step) IsCmdStep added in v1.0.7

func (s *Step) IsCmdStep() bool

IsCmdStep returns true if the Step is a command step, false otherwise.

func (*Step) IsPushStep added in v1.0.7

func (s *Step) IsPushStep() bool

IsPushStep returns true if a Step is a push step, false otherwise.

func (*Step) ShouldExecuteImmediately

func (s *Step) ShouldExecuteImmediately() bool

ShouldExecuteImmediately returns true if the Step should be executed immediately.

func (*Step) UpdateBuildStepWithDefaults added in v1.0.9

func (s *Step) UpdateBuildStepWithDefaults()

UpdateBuildStepWithDefaults updates a build step with hyperv isolation on Windows.

func (*Step) Validate

func (s *Step) Validate() error

Validate validates the step and returns an error if the Step has problems.

type StepStatus

type StepStatus string

StepStatus is an enum for step statuses.

const (
	// InProgress means the step is being processed.
	InProgress StepStatus = "inprogress"

	// Successful means the step completed and was successful.
	Successful StepStatus = "successful"

	// Skipped means the step has been skipped.
	Skipped StepStatus = "skipped"

	// Failed means the step failed because of an error.
	Failed StepStatus = "failed"
)

type Task added in v1.0.5

type Task struct {
	Steps            []*Step    `yaml:"steps"`
	StepTimeout      int        `yaml:"stepTimeout,omitempty"`
	TotalTimeout     int        `yaml:"totalTimeout,omitempty"`
	Secrets          []*Secret  `yaml:"secrets,omitempty"`
	Networks         []*Network `yaml:"networks,omitempty"`
	WorkingDirectory string     `yaml:"workingDirectory,omitempty"`
	Version          string     `yaml:"version,omitempty"`
	RegistryName     string
	RegistryUsername string
	RegistryPassword string
	Dag              *Dag
	IsBuildTask      bool     // Used to skip the default network creation for build.
	Envs             []string `yaml:"envs,omitempty"`
}

Task represents a task execution.

func NewTask added in v1.0.5

func NewTask(
	steps []*Step,
	secrets []*Secret,
	registry string,
	user string,
	pw string,
	isBuildTask bool) (*Task, error)

NewTask returns a default Task object.

func UnmarshalTaskFromFile added in v1.0.5

func UnmarshalTaskFromFile(file, registry, user, pw string) (*Task, error)

UnmarshalTaskFromFile unmarshals a Task from a file.

func UnmarshalTaskFromString added in v1.0.5

func UnmarshalTaskFromString(data, registry, user, pw, defaultWorkDir, network string, envs []string) (*Task, error)

UnmarshalTaskFromString unmarshals a Task from a raw string.

func (*Task) UsingRegistryCreds added in v1.0.5

func (t *Task) UsingRegistryCreds() bool

UsingRegistryCreds determines whether or not the Task is using registry creds.

Jump to

Keyboard shortcuts

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