-
Notifications
You must be signed in to change notification settings - Fork 210
Fix the bug that deployment timeout error was not handled #1376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ import ( | |
| ) | ||
|
|
||
| var ( | ||
| defaultDeploymentTimeout = time.Hour | ||
| defaultDeploymentTimeout = 6 * time.Hour | ||
| ) | ||
|
|
||
| // scheduler is a dedicated object for a specific deployment of a single application. | ||
|
|
@@ -220,7 +220,7 @@ func (s *scheduler) Run(ctx context.Context) error { | |
| repoCfg, ok := s.pipedConfig.GetRepository(repoID) | ||
| if !ok { | ||
| s.doneDeploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE | ||
| statusReason = fmt.Sprintf("Unable to find %q from the repository list in piped config", repoID) | ||
| statusReason = fmt.Sprintf("Repository %q is not found in the piped config", repoID) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That name was already fixed/used in the proto so let me keep it as is.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙆♀️ |
||
| s.reportDeploymentCompleted(ctx, s.doneDeploymentStatus, statusReason, "") | ||
| return fmt.Errorf("unable to find %q from the repository list in piped config", repoID) | ||
| } | ||
|
|
@@ -247,8 +247,8 @@ func (s *scheduler) Run(ctx context.Context) error { | |
| ) | ||
| } | ||
|
|
||
| // We use another deploy source provider to load the deployment configuration | ||
| // at the target commit. This provider is configured with a nil sealedSecretDecrypter | ||
| // We use another deploy source provider to load the deployment configuration at the target commit. | ||
| // This provider is configured with a nil sealedSecretDecrypter | ||
| // because decrypting the sealed secrets is not required. | ||
| // We need only the deployment configuration spec. | ||
| configDSP := deploysource.NewProvider( | ||
|
|
@@ -327,27 +327,30 @@ func (s *scheduler) Run(ctx context.Context) error { | |
| } | ||
|
|
||
| // If all operations of the stage were completed successfully | ||
| // go the next stage to handle. | ||
| // handle the next stage. | ||
| if result == model.StageStatus_STAGE_SUCCESS { | ||
| continue | ||
| } | ||
|
|
||
| sigType := sig.Signal() | ||
|
|
||
| // The deployment was cancelled by a web user. | ||
| if sigType == executor.StopSignalCancel { | ||
| if result == model.StageStatus_STAGE_CANCELLED { | ||
| deploymentStatus = model.DeploymentStatus_DEPLOYMENT_CANCELLED | ||
| statusReason = fmt.Sprintf("Deployment was cancelled by %s while executing stage %s", cancelCommander, ps.Id) | ||
| statusReason = fmt.Sprintf("Cancelled by %s while executing stage %s", cancelCommander, ps.Id) | ||
| break | ||
| } | ||
|
|
||
| // The stage was failed but not caused by the stop signal. | ||
| if result == model.StageStatus_STAGE_FAILURE && sigType == executor.StopSignalNone { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original code was missing the handling of the timeout error. |
||
| if result == model.StageStatus_STAGE_FAILURE { | ||
| deploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE | ||
| statusReason = fmt.Sprintf("Failed while executing stage %s", ps.Id) | ||
| // The stage was failed because of timing out. | ||
| if sig.Signal() == executor.StopSignalTimeout { | ||
| statusReason = fmt.Sprintf("Timed out while executing stage %s", ps.Id) | ||
| } else { | ||
| statusReason = fmt.Sprintf("Failed while executing stage %s", ps.Id) | ||
| } | ||
| break | ||
| } | ||
|
|
||
| s.logger.Info("stop scheduler because of temination signal", zap.String("stage-id", ps.Id)) | ||
| return nil | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, do we have docs that related to this default value 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be included while fixing #1373
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thank you 👍