(app models.Application)
| 265 | } |
| 266 | |
| 267 | func (cmd *Start) waitForInstancesToStage(app models.Application) (bool, error) { |
| 268 | stagingStartTime := time.Now() |
| 269 | |
| 270 | var err error |
| 271 | |
| 272 | if cmd.StagingTimeout == 0 { |
| 273 | app, err = cmd.appRepo.GetApp(app.GUID) |
| 274 | } else { |
| 275 | for app.PackageState != "STAGED" && app.PackageState != "FAILED" && time.Since(stagingStartTime) < cmd.StagingTimeout { |
| 276 | app, err = cmd.appRepo.GetApp(app.GUID) |
| 277 | if err != nil { |
| 278 | break |
| 279 | } |
| 280 | |
| 281 | time.Sleep(cmd.PingerThrottle) |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | if err != nil { |
| 286 | return false, err |
| 287 | } |
| 288 | |
| 289 | if app.PackageState == "FAILED" { |
| 290 | cmd.ui.Say("") |
| 291 | if app.StagingFailedReason == "NoAppDetectedError" { |
| 292 | return false, errors.New(T(`{{.Err}} |
| 293 | TIP: Buildpacks are detected when the "{{.PushCommand}}" is executed from within the directory that contains the app source code. |
| 294 | |
| 295 | Use '{{.BuildpackCommand}}' to see a list of supported buildpacks. |
| 296 | |
| 297 | Use '{{.Command}}' for more in depth log information.`, |
| 298 | map[string]interface{}{ |
| 299 | "Err": app.StagingFailedReason, |
| 300 | "PushCommand": terminal.CommandColor(fmt.Sprintf("%s push", cf.Name)), |
| 301 | "BuildpackCommand": terminal.CommandColor(fmt.Sprintf("%s buildpacks", cf.Name)), |
| 302 | "Command": terminal.CommandColor(fmt.Sprintf("%s logs %s --recent", cf.Name, app.Name))})) |
| 303 | } |
| 304 | return false, errors.New(T("{{.Err}}\n\nTIP: use '{{.Command}}' for more information", |
| 305 | map[string]interface{}{ |
| 306 | "Err": app.StagingFailedReason, |
| 307 | "Command": terminal.CommandColor(fmt.Sprintf("%s logs %s --recent", cf.Name, app.Name))})) |
| 308 | } |
| 309 | |
| 310 | if time.Since(stagingStartTime) >= cmd.StagingTimeout { |
| 311 | return false, nil |
| 312 | } |
| 313 | |
| 314 | return true, nil |
| 315 | } |
| 316 | |
| 317 | func (cmd *Start) waitForOneRunningInstance(app models.Application) error { |
| 318 | timer := time.NewTimer(cmd.StartupTimeout) |
no test coverage detected