本文整理匯總了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()
}