Skip to content

Commit

Permalink
Merge pull request #2939 from thaJeztah/fix_swarm_rollback_exitcode
Browse files Browse the repository at this point in the history
Fix swarm rollback exitcode, and fix skipping verify step
  • Loading branch information
silvin-lubecki authored Feb 1, 2021
2 parents d26bdfd + 104469b commit 375faee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cli/command/service/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func ServiceProgress(ctx context.Context, client client.APIClient, serviceID str
convergedAt time.Time
monitor = 5 * time.Second
rollback bool
message *progress.Progress
)

for {
Expand Down Expand Up @@ -140,16 +141,19 @@ func ServiceProgress(ctx context.Context, client client.APIClient, serviceID str
return fmt.Errorf("service rollback paused: %s", service.UpdateStatus.Message)
case swarm.UpdateStateRollbackCompleted:
if !converged {
return fmt.Errorf("service rolled back: %s", service.UpdateStatus.Message)
message = &progress.Progress{ID: "rollback", Message: service.UpdateStatus.Message}
}
rollback = true
}
}
if converged && time.Since(convergedAt) >= monitor {
progressOut.WriteProgress(progress.Progress{
ID: "verify",
Action: "Service converged",
})

if message != nil {
progressOut.WriteProgress(*message)
}
return nil
}

Expand Down

0 comments on commit 375faee

Please sign in to comment.