parser

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package parser is an implementation of yaml parser.

Package parser is an implementation of yaml parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeployNode

type DeployNode struct {
	// NodeType defines the type of the DockerNode.
	NodeType

	Applications []yaml.Application
}

DeployNode is the type for deploy section in yml.

type DockerNode

type DockerNode struct {
	// NodeType defines the type of the DockerNode.
	NodeType

	// Name of the node, when the node is running, the name is used to
	// service discovery.
	Name string

	// Commands is only for BuildNode and PreBuildNode, to support command list.
	Commands []string

	Image          string
	Pull           bool
	Privileged     bool
	Environment    []string
	Ports          []string
	Links          []string
	Entrypoint     []string
	Command        []string
	Volumes        []string
	Devices        []string
	ExtraHosts     []string
	Net            string
	DNS            []string
	AuthConfig     yaml.AuthConfig
	Memory         int64
	CPUSetCPUs     string
	OomKillDisable bool
	Outputs        []string
	DockerfilePath string
	DockerfileName string
	Vargs          map[string]interface{}
}

DockerNode represents a Docker container that should be launched as part of the build process.

type ListNode

type ListNode struct {
	NodeType
	Nodes []Node // nodes executed in lexical order.
}

ListNode holds a sequence of nodes.

type Node

type Node interface {
	Type() NodeType
}

Node is the interface of a generic node.

type NodeType

type NodeType uint

NodeType identifies the type of a parse tree node.

const (
	NodeList NodeType = 1 << iota
	NodeIntegration
	NodePreBuild
	NodeBuild
	NodePostBuild
	NodeService
	NodeDeploy
)

func (NodeType) Type

func (t NodeType) Type() NodeType

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

type Tree

type Tree struct {
	Root *ListNode
	// Now deploy is independent with CI.
	DeployConfig *DeployNode

	NumberContatiner int
}

Tree is the representation of a parsed build configuration Yaml file.

func Load

func Load(conf *yaml.Config) (*Tree, error)

Load loads the Yaml build definition structure and returns an execution Tree.

func Parse

func Parse(raw []byte) (*Tree, error)

Parse parses the Yaml build definition file and returns an execution Tree.

func ParseString

func ParseString(raw string) (*Tree, error)

ParseString parses the Yaml build definition file and returns an execution Tree.

Jump to

Keyboard shortcuts

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