Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions core/environment/transition_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ func (t DeployTransition) do(env *Environment) (err error) {

deploymentTimeout := acquireDeploymentTimeout(wf)

numberOfLeaves := 0
workflow.LeafWalk(wf, func(role workflow.Role) {
numberOfLeaves += 1
})

numberOfStatusChanges := 0

wfStatus := wf.GetStatus()
if wfStatus != task.ACTIVE {
log.WithField("partition", env.Id().String()).
Expand All @@ -228,6 +235,8 @@ func (t DeployTransition) do(env *Environment) (err error) {
log.WithField("status", wfStatus.String()).
WithField("partition", env.Id().String()).
Debug("workflow status change")
numberOfStatusChanges += 1

if wfStatus == task.ACTIVE {
break WORKFLOW_ACTIVE_LOOP
} else if wfStatus == task.UNDEPLOYABLE {
Expand Down Expand Up @@ -255,7 +264,11 @@ func (t DeployTransition) do(env *Environment) (err error) {
inactiveTaskRolesS := strings.Join(undeployableTaskRoles, ", ")

err = fmt.Errorf("workflow deployment failed (one or more roles undeployable), aborting and cleaning up [undeployable roles: %s]", inactiveTaskRolesS)
break WORKFLOW_ACTIVE_LOOP
}

if numberOfStatusChanges >= numberOfLeaves {
err = fmt.Errorf("workflow did not receive ACTIVE status after all (%d) roles reported their statuses", numberOfLeaves)
break WORKFLOW_ACTIVE_LOOP
}
continue
Expand Down