harness-drone/engine/compiler/builtin/pull.go

27 lines
505 B
Go
Raw Normal View History

2016-04-16 07:51:05 +00:00
package builtin
import (
"github.com/drone/drone/engine/compiler/parse"
)
type pullOp struct {
visitor
pull bool
}
// NewPullOp returns a transformer that configures plugins to automatically
// pull the latest images at runtime.
func NewPullOp(pull bool) Visitor {
return &pullOp{
pull: pull,
}
}
func (v *pullOp) VisitContainer(node *parse.ContainerNode) error {
switch node.NodeType {
case parse.NodePlugin, parse.NodeCache, parse.NodeClone:
node.Container.Pull = v.pull
}
return nil
}