本文整理汇总了Golang中github.com/tsuru/tsuru/provision.App.GetDeploys方法的典型用法代码示例。如果您正苦于以下问题:Golang App.GetDeploys方法的具体用法?Golang App.GetDeploys怎么用?Golang App.GetDeploys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsuru/tsuru/provision.App
的用法示例。
在下文中一共展示了App.GetDeploys方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: usePlatformImage
func usePlatformImage(app provision.App) bool {
deploys := app.GetDeploys()
if (deploys != 0 && deploys%10 == 0) || app.GetUpdatePlatform() {
return true
}
return false
}
示例2: AddUnits
func (p *dockerProvisioner) AddUnits(a provision.App, units uint, process string, w io.Writer) ([]provision.Unit, error) {
if a.GetDeploys() == 0 {
return nil, stderr.New("New units can only be added after the first deployment")
}
if units == 0 {
return nil, stderr.New("Cannot add 0 units")
}
if w == nil {
w = ioutil.Discard
}
writer := io.MultiWriter(w, &app.LogWriter{App: a})
imageId, err := appCurrentImageName(a.GetName())
if err != nil {
return nil, err
}
conts, err := p.runCreateUnitsPipeline(writer, a, map[string]*containersToAdd{process: {Quantity: int(units)}}, imageId)
routesRebuildOrEnqueue(a.GetName())
if err != nil {
return nil, err
}
result := make([]provision.Unit, len(conts))
for i, c := range conts {
result[i] = c.AsUnit(a)
}
return result, nil
}
示例3: ExecuteCommandIsolated
func (p *swarmProvisioner) ExecuteCommandIsolated(stdout, stderr io.Writer, a provision.App, cmd string, args ...string) error {
if a.GetDeploys() == 0 {
return errors.New("commands can only be executed after the first deploy")
}
img, err := image.AppCurrentImageName(a.GetName())
if err != nil {
return err
}
client, err := chooseDBSwarmNode()
if err != nil {
return err
}
opts := tsuruServiceOpts{
app: a,
image: img,
isIsolatedRun: true,
}
cmds := []string{"/bin/bash", "-lc", cmd}
cmds = append(cmds, args...)
serviceID, _, err := runOnceCmds(client, opts, cmds, stdout, stderr)
if serviceID != "" {
removeServiceAndLog(client, serviceID)
}
return err
}
示例4: usePlatformImage
func usePlatformImage(app provision.App) bool {
maxLayers, _ := config.GetUint("docker:max-layers")
if maxLayers == 0 {
maxLayers = 10
}
deploys := app.GetDeploys()
return deploys%maxLayers == 0 || app.GetUpdatePlatform()
}
示例5: AddUnits
func (p *dockerProvisioner) AddUnits(a provision.App, units uint, process string, w io.Writer) error {
if a.GetDeploys() == 0 {
return errors.New("New units can only be added after the first deployment")
}
if units == 0 {
return errors.New("Cannot add 0 units")
}
if w == nil {
w = ioutil.Discard
}
writer := io.MultiWriter(w, &app.LogWriter{App: a})
imageId, err := image.AppCurrentImageName(a.GetName())
if err != nil {
return err
}
imageData, err := image.GetImageCustomData(imageId)
if err != nil {
return err
}
_, err = p.runCreateUnitsPipeline(writer, a, map[string]*containersToAdd{process: {Quantity: int(units)}}, imageId, imageData.ExposedPort)
return err
}
示例6: changeUnits
func changeUnits(a provision.App, units int, processName string, w io.Writer) error {
if a.GetDeploys() == 0 {
return errors.New("units can only be modified after the first deploy")
}
if units == 0 {
return errors.New("cannot change 0 units")
}
client, err := chooseDBSwarmNode()
if err != nil {
return err
}
imageId, err := image.AppCurrentImageName(a.GetName())
if err != nil {
return err
}
if processName == "" {
_, processName, err = dockercommon.ProcessCmdForImage(processName, imageId)
if err != nil {
return errors.WithStack(err)
}
}
return deployProcesses(client, a, imageId, processSpec{processName: processState{increment: units}})
}
示例7: usePlatformImage
func (p *dockerProvisioner) usePlatformImage(app provision.App) bool {
deploys := app.GetDeploys()
return deploys%10 == 0 || app.GetUpdatePlatform()
}