@@ -217,6 +217,13 @@ func (t DeployTransition) do(env *Environment) (err error) {
217217
218218 deploymentTimeout := acquireDeploymentTimeout (wf )
219219
220+ numberOfLeaves := 0
221+ workflow .LeafWalk (wf , func (role workflow.Role ) {
222+ numberOfLeaves += 1
223+ })
224+
225+ numberOfStatusChanges := 0
226+
220227 wfStatus := wf .GetStatus ()
221228 if wfStatus != task .ACTIVE {
222229 log .WithField ("partition" , env .Id ().String ()).
@@ -228,6 +235,8 @@ func (t DeployTransition) do(env *Environment) (err error) {
228235 log .WithField ("status" , wfStatus .String ()).
229236 WithField ("partition" , env .Id ().String ()).
230237 Debug ("workflow status change" )
238+ numberOfStatusChanges += 1
239+
231240 if wfStatus == task .ACTIVE {
232241 break WORKFLOW_ACTIVE_LOOP
233242 } else if wfStatus == task .UNDEPLOYABLE {
@@ -255,7 +264,11 @@ func (t DeployTransition) do(env *Environment) (err error) {
255264 inactiveTaskRolesS := strings .Join (undeployableTaskRoles , ", " )
256265
257266 err = fmt .Errorf ("workflow deployment failed (one or more roles undeployable), aborting and cleaning up [undeployable roles: %s]" , inactiveTaskRolesS )
267+ break WORKFLOW_ACTIVE_LOOP
268+ }
258269
270+ if numberOfStatusChanges >= numberOfLeaves {
271+ err = fmt .Errorf ("workflow did not receive ACTIVE status after all (%d) roles reported their statuses" , numberOfLeaves )
259272 break WORKFLOW_ACTIVE_LOOP
260273 }
261274 continue
0 commit comments