-
Notifications
You must be signed in to change notification settings - Fork 135
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
Fix wrong condition on determine deployment plannable #2860
Conversation
The following ISSUES will be created once got merged. If you want me to skip creating the issue, you can use Details1. Consider add deployment status to the deployment ref in the deployment chain modelThis was created by todo plugin since "TODO:" was found in 73aec2e when #2860 was merged. cc: @khanhtc1202. |
/todo skip |
Code coverage for golang is
|
deploymentIds = append(deploymentIds, node.DeploymentRef.DeploymentId) | ||
} | ||
|
||
// TODO: Consider add deployment status to the deployment ref in the deployment chain model | ||
// instead of fetching deployment model here. | ||
blockDeployments, _, err := a.deploymentStore.ListDeployments(ctx, datastore.ListOptions{ | ||
Filters: []datastore.ListFilter{ | ||
{ | ||
Field: "Id", | ||
Operator: datastore.OperatorIn, | ||
Value: deploymentIds, | ||
}, | ||
}, | ||
}) | ||
if err != nil { | ||
return nil, status.Error(codes.Internal, "unable to process previous block nodes in deployment chain") | ||
} | ||
|
||
plannable := true | ||
for _, dp := range blockDeployments { | ||
if !model.IsSuccessfullyCompletedDeployment(dp.Status) { |
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.
Could you tell me what was wrong with determining logic?
Or we just changed from using Get to List with the In
operator.
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.
The condition is flipped, previously it was
if model.IsSuccessfullyCompletedDeployment(dp.Status) {
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!
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.
And as you said, I changed the implementation to use In
operator to reduce database read, but the TODO note has remained. I will address the issue of adding deployment status to the node.DeploymentRef later, currently just want to focus on the deployment chain flow works 🙏
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.
Thank you 🙆♀️
/lgtm |
Good catch |
What this PR does / why we need it:
Which issue(s) this PR fixes:
Follow PR #2832
Does this PR introduce a user-facing change?: