本文整理汇总了Golang中github.com/megamsys/libgo/action.NewPipeline函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPipeline函数的具体用法?Golang NewPipeline怎么用?Golang NewPipeline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewPipeline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Destroy
func (p *oneProvisioner) Destroy(box *provision.Box, w io.Writer) error {
fmt.Fprintf(w, "\n--- destroying box (%s)\n", box.GetFullName())
args := runMachineActionsArgs{
box: box,
writer: w,
isDeploy: false,
machineStatus: provision.StatusDestroying,
provisioner: p,
}
actions := []*action.Action{
&updateStatusInRiak,
&destroyOldMachine,
&destroyOldRoute,
}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(args)
if err != nil {
fmt.Fprintf(w, "--- destroying box (%s)\n --> %s", box.GetFullName(), err)
return err
}
err = doneNotify(box, w, alerts.DESTROYED)
return nil
}
示例2: deployPipeline
func (p *dockerProvisioner) deployPipeline(box *provision.Box, imageId string, w io.Writer) (string, error) {
fmt.Fprintf(w, "\n--- deploy box (%s, image:%s)\n", box.GetFullName(), imageId)
actions := []*action.Action{
&updateStatusInRiak,
&createContainer,
&startContainer,
&updateStatusInRiak,
&setNetworkInfo,
&followLogsAndCommit,
}
pipeline := action.NewPipeline(actions...)
args := runContainerActionsArgs{
box: box,
imageId: imageId,
writer: w,
isDeploy: true,
buildingImage: imageId,
containerStatus: provision.StatusLaunching,
provisioner: p,
}
err := pipeline.Execute(args)
if err != nil {
fmt.Fprintf(w, "deploy pipeline for box (%s)\n --> %s", box.GetFullName(), err)
return "", err
}
return imageId, nil
}
示例3: Stop
func (p *oneProvisioner) Stop(box *provision.Box, process string, w io.Writer) error {
fmt.Fprintf(w, "\n--- stoping box (%s)\n", box.GetFullName())
args := runMachineActionsArgs{
box: box,
writer: w,
isDeploy: false,
machineStatus: provision.StatusStopping,
provisioner: p,
}
actions := []*action.Action{
&updateStatusInRiak,
&stopMachine,
&updateStatusInRiak,
}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(args)
if err != nil {
fmt.Fprintf(w, "--- stoping box (%s)\n --> %s", box.GetFullName(), err)
return err
}
return nil
}
示例4: Bootstrap
func (p *chefsoloProvisioner) Bootstrap(box *provision.Box, w io.Writer) error {
fmt.Fprintf(w, "--- bootstrap box (%s)\n", box.GetFullName())
actions := []*action.Action{
&createMachine,
&updateStatusInRiak,
&updateIpsInRiak,
&appendAuthKeys,
&updateStatusInRiak,
&changeStateofMachine,
}
pipeline := action.NewPipeline(actions...)
args := runMachineActionsArgs{
box: box,
writer: w,
machineStatus: constants.StatusBootstrapping,
provisioner: p,
}
if err := pipeline.Execute(args); err != nil {
return err
}
fmt.Fprintf(w, "--- bootstrap box (%s) OK\n", box.GetFullName())
return nil
}
示例5: StopComponent
func StopComponent(app *global.Component) error {
actions := []*action.Action{&stopComponent}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(app)
if err != nil {
return &AppLifecycleError{app: app.Name, Err: err}
}
return nil
}
示例6: StartApp
func StartApp(app *global.AssemblyWithComponents) error {
actions := []*action.Action{&startApp}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(app)
if err != nil {
return &AppLifecycleError{app: app.Name, Err: err}
}
return nil
}
示例7: StreamLogs
func StreamLogs(logs *global.DockerLogsInfo) error {
actions := []*action.Action{&streamLogs}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(logs)
if err != nil {
return &AppLifecycleError{app: logs.ContainerName, Err: err}
}
return nil
}
示例8: AnalyticsProcess
//
// this executes all actions for megam install
//
func AnalyticsProcess(app *global.App) error {
actions := []*action.Action{&analyticsAction}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(app)
if err != nil {
return err
}
return nil
}
示例9: Shipper
func Shipper(app *global.Assemblies) error {
actions := []*action.Action{&shipper}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(app)
if err != nil {
return &AppLifecycleError{app: app.Name, Err: err}
}
return nil
}
示例10: ConfigureNetworks
func ConfigureNetworks(networks *global.DockerNetworksInfo) error {
actions := []*action.Action{&configureNetworks}
pipeline := action.NewPipeline(actions...)
err := pipeline.Execute(networks)
if err != nil {
return &AppLifecycleError{app: networks.ContainerId, Err: err}
}
return nil
}
示例11: opsBind
func (u *Upgradeable) opsBind(writer io.Writer) error {
u.w = writer
fmt.Fprintf(u.w, " ops bind (%s) is kicking\n", u.B.GetFullName())
actions := []*action.Action{
&setEnvsAction,
}
pipeline := action.NewPipeline(actions...)
args := runOpsPipelineArgs{
box: u.B,
writer: u.w,
}
if err := pipeline.Execute(&args); err != nil {
return err
}
fmt.Fprintf(u.w, " ops bind (%s) OK\n", u.B.GetFullName())
return nil
}
示例12: LauncherHelper
func LauncherHelper(asm *global.AssemblyWithComponents, id string, instance bool, act_id string) error {
pair_host, perrscm := global.ParseKeyValuePair(asm.Inputs, "provider")
if perrscm != nil {
log.Error("Failed to get the host value : %s", perrscm)
}
if pair_host.Value == "docker" {
log.Debug("Docker provisioner entry")
// Provisioner
p, err := provisioner.GetProvisioner("docker")
if err != nil {
return err
}
log.Info("Provisioner: %v", p)
_, perr := p.Create(asm, id, instance, act_id)
if perr != nil {
return perr
}
}
if pair_host.Value == "chef" {
p, err := provisioner.GetProvisioner("chef")
if err != nil {
return err
}
str, perr := p.Create(asm, id, instance, act_id)
if perr != nil {
return perr
}
asm.Command = str
actions := []*action.Action{&launchedApp}
pipeline := action.NewPipeline(actions...)
aerr := pipeline.Execute(asm)
if aerr != nil {
return aerr
}
}
return nil
}
示例13: opsBuild
func (u *Upgradeable) opsBuild(writer io.Writer) error {
u.w = writer
fmt.Fprintf(u.w, " ops ci (%s) is kicking\n", u.B.GetFullName())
actions := []*action.Action{
&cloneBox,
&buildBox, //buildpack does everthing
}
pipeline := action.NewPipeline(actions...)
args := runOpsPipelineArgs{
box: u.B,
writer: u.w,
}
if err := pipeline.Execute(&args); err != nil {
return err
}
fmt.Fprintf(u.w, " ops ci (%s) OK\n", u.B.GetFullName())
return nil
}
示例14: createLogPipeline
func (p *DockerProvisioner) createLogPipeline(writer io.Writer, closeChan chan bool) error {
actions := []*action.Action{
&setLogs,
}
pipeline := action.NewPipeline(actions...)
args := runLogsActionsArgs{
Id: p.ContainerId,
Name: p.ContainerName,
HomeDir: p.HomeDir,
Writer: writer,
CloseChan: closeChan,
}
err := pipeline.Execute(args)
if err != nil {
log.Errorf("Error on executing Log setup")
return err
}
return nil
}
示例15: createNetworkPipeline
func (p *DockerProvisioner) createNetworkPipeline() error {
actions := []*action.Action{
&setNetwork,
}
pipeline := action.NewPipeline(actions...)
args := runNetworkActionsArgs{
Id: p.ContainerId,
IpAddr: p.IpAddr,
Bridge: p.Bridge,
Gateway: p.Gateway,
HomeDir: p.HomeDir,
}
err := pipeline.Execute(args)
if err != nil {
log.Errorf("Error on executing Network setup")
return err
}
return nil
}