Skip to content

Conversation

@khanhtc1202
Copy link
Member

What this PR does / why we need it:

Check plannability of the deployment before actually planning it using InChainPlannableDeployment RPC

Which issue(s) this PR fixes:

Fixes #2827

Does this PR introduce a user-facing change?:

NONE

@pipecd-bot
Copy link
Collaborator

DOCKER

Unabled to get changed files of pull request.

Details
Error: rpc error: code = NotFound desc = not found

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.69%. This pull request decreases coverage by -0.04%.

File Function Base Head Diff
pkg/app/piped/controller/controller.go controller.shouldStartPlanningDeployment -- 0.00% +0.00%
pkg/model/deployment.go Deployment.IsInChainDeployment -- 0.00% +0.00%
pkg/app/piped/controller/controller.go controller.syncPlanners 0.00% 0.00% +0.00%
pkg/app/piped/planpreview/terraformdiff.go builder.terraformDiff 0.00% 0.00% +0.00%

}
continue
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any way to show the reason why a deployment has not been planned on the web?
Should we set that message by trigger or planner?

Copy link
Member Author

@khanhtc1202 khanhtc1202 Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we don't have, since the state of the deployment is not changed, the message for that keep PENDING may be redundant to me. If we want to show kind of reason why the deployment keeps pending, we may need a new RPC like UpdateDeploymentStatusReason or such. How do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to ask to know did you have any plan for that thing yet.
Could you create a new issue to ensure that it could not be flushed out of our memory over time?
Btw, I will approve this PR since that is out of the scope of this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, in that case

Should we set that message by trigger or planner?

Probably not the trigger since after triggering the deployment to start (PENDING state) the trigger is out of action, and this check is plannable logic run in syncPlaner phase but before a planner starts running, so the one who submits that message should be controller itself, via kind of UpdateDeploymentStatusReason RPC (the deployment state is unchanged but update the desc?) that is in my image. Let's me think about that in detail later (will create issue for that)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #2848 🙏

return true, nil
}
resp, err := c.apiClient.InChainDeploymentPlannable(ctx, &pipedservice.InChainDeploymentPlannableRequest{
Deployment: d,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I have just found a thing.
Do you need to send the whole deployment object?
It might be a bit redundant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To determine should we plan that deployment, currently we need: DeploymentChainId and DeploymentChainBlockIndex, not the whole deployment object. Should we only submit those 2 fields? I'm okay with both but in the future, if we need more than that to determine if this deployment should be planed or not, we have to update RPC too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
Let's change the RPC to use just needed fields.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure 🙆‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed by 87054ac

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.69%. This pull request decreases coverage by -0.04%.

File Function Base Head Diff
pkg/app/piped/controller/controller.go controller.shouldStartPlanningDeployment -- 0.00% +0.00%
pkg/model/deployment.go Deployment.IsInChainDeployment -- 0.00% +0.00%
pkg/app/piped/controller/controller.go controller.syncPlanners 0.00% 0.00% +0.00%
pkg/app/piped/planpreview/terraformdiff.go builder.terraformDiff 0.00% 0.00% +0.00%

@nghialv
Copy link
Member

nghialv commented Nov 25, 2021

Nice.
/lgtm

@nakabonne
Copy link
Member

Cool
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nakabonne.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit d4c480b into master Nov 25, 2021
@pipecd-bot pipecd-bot deleted the add-check-plannable-logc branch November 25, 2021 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update piped planner to lock deployment triggered by chain until the previous block in chain deployed

5 participants