harness-drone/engine/compiler/parse/node_build.go
2016-04-16 00:51:05 -07:00

42 lines
762 B
Go

package parse
// BuildNode represents Docker image build instructions.
type BuildNode struct {
NodeType
Context string
Dockerfile string
Args map[string]string
root *RootNode
}
// Root returns the root node.
func (n *BuildNode) Root() *RootNode { return n.root }
//
// intermediate types for yaml decoding.
//
type build struct {
Context string
Dockerfile string
Args map[string]string
}
func (b *build) UnmarshalYAML(unmarshal func(interface{}) error) error {
err := unmarshal(&b.Context)
if err == nil {
return nil
}
out := struct {
Context string
Dockerfile string
Args map[string]string
}{}
err = unmarshal(&out)
b.Context = out.Context
b.Args = out.Args
b.Dockerfile = out.Dockerfile
return err
}