parse

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeBuild     = "build"
	NodeCache     = "cache"
	NodeClone     = "clone"
	NodeContainer = "container"
	NodeNetwork   = "network"
	NodePlugin    = "plugin"
	NodeRoot      = "root"
	NodeService   = "service"
	NodeShell     = "shell"
	NodeVolume    = "volume"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildNode

type BuildNode struct {
	NodeType

	Context    string
	Dockerfile string
	Args       map[string]string
	// contains filtered or unexported fields
}

BuildNode represents Docker image build instructions.

func (*BuildNode) Root

func (n *BuildNode) Root() *RootNode

Root returns the root node.

type Conditions

type Conditions struct {
	Platform    []string
	Environment []string
	Event       []string
	Branch      []string
	Status      []string
	Matrix      map[string]string
}

type ContainerNode

type ContainerNode struct {
	NodeType

	// Container represents the container configuration.
	Container  runner.Container
	Conditions Conditions
	Disabled   bool
	Commands   []string
	Vargs      map[string]interface{}
	// contains filtered or unexported fields
}

ContainerNode represents a Docker container.

func (*ContainerNode) OnFailure

func (n *ContainerNode) OnFailure() bool

OnFailure returns true if the container should be executed even when the exit code of the previous step != 0.

func (*ContainerNode) OnSuccess

func (n *ContainerNode) OnSuccess() bool

OnSuccess returns true if the container should be executed when the exit code of the previous step is 0.

func (*ContainerNode) Root

func (n *ContainerNode) Root() *RootNode

Root returns the root node.

type NetworkNode

type NetworkNode struct {
	NodeType

	Name       string
	Driver     string
	DriverOpts map[string]string
	// contains filtered or unexported fields
}

NetworkNode represents a Docker network.

func (*NetworkNode) Root

func (n *NetworkNode) Root() *RootNode

Root returns the root node.

type Node

type Node interface {
	Type() NodeType
	Root() *RootNode
}

A Node is an element in the parse tree.

type NodeType

type NodeType string

NodeType identifies the type of parse tree node.

func (NodeType) String

func (t NodeType) String() string

String returns the string value of the Node type.

func (NodeType) Type

func (t NodeType) Type() NodeType

Type returns itself an provides an easy default implementation. for embedding in a Node. Embedded in all non-trivial Nodes.

type RootNode

type RootNode struct {
	NodeType

	Platform string
	Base     string
	Path     string
	Image    string

	Pod      Node
	Build    Node
	Cache    Node
	Clone    Node
	Script   []Node
	Volumes  []Node
	Networks []Node
	Services []Node
}

RootNode is the root node in the parsed Yaml file.

func NewRootNode

func NewRootNode() *RootNode

NewRootNode returns a new root node.

func Parse

func Parse(in []byte) (*RootNode, error)

Parse parses a Yaml file and returns a Tree structure.

func ParseString

func ParseString(in string) (*RootNode, error)

ParseString parses a Yaml string and returns a Tree structure.

func (*RootNode) NewBuildNode

func (n *RootNode) NewBuildNode(context string) *BuildNode

Returns a new Network Node.

func (*RootNode) NewCacheNode

func (n *RootNode) NewCacheNode() *ContainerNode

Returns a new Container Cache Node.

func (*RootNode) NewCloneNode

func (n *RootNode) NewCloneNode() *ContainerNode

Returns a new Container Clone Node.

func (*RootNode) NewContainerNode

func (n *RootNode) NewContainerNode() *ContainerNode

Returns a new Container Node.

func (*RootNode) NewNetworkNode

func (n *RootNode) NewNetworkNode(name string) *NetworkNode

Returns a new Network Node.

func (*RootNode) NewPluginNode

func (n *RootNode) NewPluginNode() *ContainerNode

Returns a new Container Plugin Node.

func (*RootNode) NewServiceNode

func (n *RootNode) NewServiceNode() *ContainerNode

Returns a new Container Service Node.

func (*RootNode) NewShellNode

func (n *RootNode) NewShellNode() *ContainerNode

Returns a new Container Shell Node.

func (*RootNode) NewVolumeNode

func (n *RootNode) NewVolumeNode(name string) *VolumeNode

Returns a new Volume Node.

func (*RootNode) Root

func (n *RootNode) Root() *RootNode

Root returns the root node.

func (*RootNode) Walk

func (n *RootNode) Walk(fn WalkFunc) (err error)

Walk is a function that walk through all child nodes of the RootNode and invokes the Walk callback function for each Node.

type VolumeNode

type VolumeNode struct {
	NodeType

	Name       string
	Driver     string
	DriverOpts map[string]string
	External   bool
	// contains filtered or unexported fields
}

VolumeNode represents a Docker volume.

func (*VolumeNode) Root

func (n *VolumeNode) Root() *RootNode

Root returns the root node.

type WalkFunc

type WalkFunc func(Node) error

Jump to

Keyboard shortcuts

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