本文整理汇总了Golang中github.com/tsuru/tsuru/action.Pipeline.Execute方法的典型用法代码示例。如果您正苦于以下问题:Golang Pipeline.Execute方法的具体用法?Golang Pipeline.Execute怎么用?Golang Pipeline.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsuru/tsuru/action.Pipeline
的用法示例。
在下文中一共展示了Pipeline.Execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Deploy
// Deploy runs a deployment of an application. It will first try to run an
// archive based deploy (if opts.ArchiveURL is not empty), and then fallback to
// the Git based deployment.
func Deploy(opts DeployOptions) error {
var pipeline *action.Pipeline
start := time.Now()
if cprovisioner, ok := Provisioner.(provision.CustomizedDeployPipelineProvisioner); ok {
pipeline = cprovisioner.DeployPipeline()
} else {
actions := []*action.Action{&ProvisionerDeploy, &IncrementDeploy}
pipeline = action.NewPipeline(actions...)
}
logWriter := LogWriter{App: opts.App, Writer: opts.OutputStream}
err := pipeline.Execute(opts, &logWriter)
elapsed := time.Since(start)
if err != nil {
saveDeployData(opts.App.Name, opts.Commit, elapsed, err)
return err
}
if opts.App.UpdatePlatform == true {
opts.App.SetUpdatePlatform(false)
}
return saveDeployData(opts.App.Name, opts.Commit, elapsed, nil)
}
示例2: runReplaceUnitsPipeline
func (p *dockerProvisioner) runReplaceUnitsPipeline(w io.Writer, a provision.App, toAdd map[string]*containersToAdd, toRemoveContainers []container.Container, imageId string, toHosts ...string) ([]container.Container, error) {
var toHost string
if len(toHosts) > 0 {
toHost = toHosts[0]
}
if w == nil {
w = ioutil.Discard
}
args := changeUnitsPipelineArgs{
app: a,
toAdd: toAdd,
toRemove: toRemoveContainers,
toHost: toHost,
writer: w,
imageId: imageId,
provisioner: p,
}
var pipeline *action.Pipeline
if p.isDryMode {
pipeline = action.NewPipeline(
&provisionAddUnitsToHost,
&provisionRemoveOldUnits,
)
} else {
pipeline = action.NewPipeline(
&provisionAddUnitsToHost,
&bindAndHealthcheck,
&addNewRoutes,
&removeOldRoutes,
&updateAppImage,
&provisionRemoveOldUnits,
&provisionUnbindOldUnits,
)
}
err := pipeline.Execute(args)
if err != nil {
return nil, err
}
return pipeline.Result().([]container.Container), nil
}