當前位置: 首頁>>代碼示例>>Golang>>正文


Golang action.Pipeline類代碼示例

本文整理匯總了Golang中github.com/tsuru/tsuru/action.Pipeline的典型用法代碼示例。如果您正苦於以下問題:Golang Pipeline類的具體用法?Golang Pipeline怎麽用?Golang Pipeline使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Pipeline類的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)
}
開發者ID:rualatngua,項目名稱:tsuru,代碼行數:24,代碼來源:deploy.go

示例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
}
開發者ID:gwmoura,項目名稱:yati,代碼行數:40,代碼來源:containers.go


注:本文中的github.com/tsuru/tsuru/action.Pipeline類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。