Merge pull request #2939 from thaJeztah/fix_swarm_rollback_exitcode

Fix swarm rollback exitcode, and fix skipping verify step
This commit is contained in:
Silvin Lubecki 2021-02-01 11:29:15 +01:00 committed by GitHub
commit 375faee9bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -99,6 +99,7 @@ func ServiceProgress(ctx context.Context, client client.APIClient, serviceID str
convergedAt time.Time convergedAt time.Time
monitor = 5 * time.Second monitor = 5 * time.Second
rollback bool rollback bool
message *progress.Progress
) )
for { for {
@ -140,8 +141,9 @@ func ServiceProgress(ctx context.Context, client client.APIClient, serviceID str
return fmt.Errorf("service rollback paused: %s", service.UpdateStatus.Message) return fmt.Errorf("service rollback paused: %s", service.UpdateStatus.Message)
case swarm.UpdateStateRollbackCompleted: case swarm.UpdateStateRollbackCompleted:
if !converged { 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 { if converged && time.Since(convergedAt) >= monitor {
@ -149,7 +151,9 @@ func ServiceProgress(ctx context.Context, client client.APIClient, serviceID str
ID: "verify", ID: "verify",
Action: "Service converged", Action: "Service converged",
}) })
if message != nil {
progressOut.WriteProgress(*message)
}
return nil return nil
} }