@@ -298,9 +298,9 @@ func (actor Actor) PollStart(app resources.Application, noWait bool, handleInsta
298
298
}
299
299
}
300
300
301
- // PollStartForRolling polls a deploying application's processes until some are started. It does the same thing as PollStart, except it accounts for rolling deployments and whether
301
+ // PollStartForDeployment polls a deploying application's processes until some are started. It does the same thing as PollStart, except it accounts for rolling/canary deployments and whether
302
302
// they have failed or been canceled during polling.
303
- func (actor Actor ) PollStartForRolling (app resources.Application , deploymentGUID string , noWait bool , handleInstanceDetails func (string )) (Warnings , error ) {
303
+ func (actor Actor ) PollStartForDeployment (app resources.Application , deploymentGUID string , noWait bool , handleInstanceDetails func (string )) (Warnings , error ) {
304
304
var (
305
305
deployment resources.Deployment
306
306
processes []resources.Process
@@ -321,7 +321,7 @@ func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID
321
321
}
322
322
return allWarnings , actionerror.StartupTimeoutError {Name : app .Name }
323
323
case <- timer .C ():
324
- if ! isDeployed (deployment ) {
324
+ if ! isDeployProcessed (deployment ) {
325
325
ccDeployment , warnings , err := actor .getDeployment (deploymentGUID )
326
326
allWarnings = append (allWarnings , warnings ... )
327
327
if err != nil {
@@ -335,7 +335,7 @@ func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID
335
335
}
336
336
}
337
337
338
- if noWait || isDeployed (deployment ) {
338
+ if noWait || isDeployProcessed (deployment ) {
339
339
stopPolling , warnings , err := actor .PollProcesses (processes , handleInstanceDetails )
340
340
allWarnings = append (allWarnings , warnings ... )
341
341
if stopPolling || err != nil {
@@ -348,7 +348,12 @@ func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID
348
348
}
349
349
}
350
350
351
- func isDeployed (d resources.Deployment ) bool {
351
+ func isDeployProcessed (d resources.Deployment ) bool {
352
+ if d .Strategy == constant .DeploymentStrategyCanary {
353
+ return d .StatusValue == constant .DeploymentStatusValueActive && d .StatusReason == constant .DeploymentStatusReasonPaused ||
354
+ d .StatusValue == constant .DeploymentStatusValueFinalized && d .StatusReason == constant .DeploymentStatusReasonDeployed
355
+ }
356
+
352
357
return d .StatusValue == constant .DeploymentStatusValueFinalized && d .StatusReason == constant .DeploymentStatusReasonDeployed
353
358
}
354
359
@@ -439,7 +444,7 @@ func (actor Actor) getProcesses(deployment resources.Deployment, appGUID string,
439
444
440
445
// if the deployment is deployed we know web are all running and PollProcesses will see those as stable
441
446
// so just getting all processes is equivalent to just getting non-web ones and polling those
442
- if isDeployed (deployment ) {
447
+ if isDeployProcessed (deployment ) {
443
448
processes , warnings , err := actor .CloudControllerClient .GetApplicationProcesses (appGUID )
444
449
if err != nil {
445
450
return processes , Warnings (warnings ), err
0 commit comments