Skip to content
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

Add DeployTargetsByPlugin to Web API #5556

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Add DeployTargetsByPlugin to Web API #5556

merged 1 commit into from
Feb 10, 2025

Conversation

khanhtc1202
Copy link
Member

What this PR does:

as title

Why we need it:

These API will be used by forms in Web UI to register and edit application

Which issue(s) this PR fixes:

Part of #5252

Does this PR introduce a user-facing change?:

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Project coverage is 26.42%. Comparing base (ed28c89) to head (0b0e63c).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
pkg/app/server/grpcapi/web_api.go 0.00% 12 Missing ⚠️
pkg/datastore/datastoretest/datastore.mock.go 0.00% 4 Missing ⚠️
pkg/datastore/applicationstore.go 0.00% 2 Missing ⚠️
pkg/app/server/grpcapi/api.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5556      +/-   ##
==========================================
- Coverage   26.43%   26.42%   -0.01%     
==========================================
  Files         465      465              
  Lines       49901    49913      +12     
==========================================
  Hits        13189    13189              
- Misses      35657    35669      +12     
  Partials     1055     1055              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -360,7 +360,7 @@ func (a *API) UpdateApplication(ctx context.Context, req *apiservice.UpdateAppli
return nil, status.Error(codes.InvalidArgument, "Requested piped does not belong to your project")
}

if err := a.applicationStore.UpdateConfiguration(ctx, req.ApplicationId, req.PipedId, req.PlatformProvider, req.GitPath.ConfigFilename); err != nil {
if err := a.applicationStore.UpdateConfiguration(ctx, req.ApplicationId, req.PipedId, req.PlatformProvider, req.GitPath.ConfigFilename, nil); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add req.DeployTargetsByPlugin as args?

Suggested change
if err := a.applicationStore.UpdateConfiguration(ctx, req.ApplicationId, req.PipedId, req.PlatformProvider, req.GitPath.ConfigFilename, nil); err != nil {
if err := a.applicationStore.UpdateConfiguration(ctx, req.ApplicationId, req.PipedId, req.PlatformProvider, req.GitPath.ConfigFilename, req.DeployTargetsByPlugin); err != nil {

Copy link
Member Author

@khanhtc1202 khanhtc1202 Feb 7, 2025

Choose a reason for hiding this comment

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

I don't update api service.proto (API for pipectl and external tool), so there is no req.DeployTargetsByPlugin, just pass nil here and not update the grpc for this API since this one is used by pipectl and outer tool (like https://github.com/pipe-cd/terraform-provider-pipecd), I will consider to update this later

Copy link
Member

@ffjlabo ffjlabo Feb 10, 2025

Choose a reason for hiding this comment

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

@khanhtc1202 I got it and OK to consider later. So it would be nice to add a comment about the context.

IMO, we need to update the API for pipectl and external tool because it will update as nil when adding the app and later update via pipectl and some other tool.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ffjlabo Ofcource, we will update pipectl commands related to applications later. I just do not want to update the API this time to confuse the outer tools dev because the pipedv1 plugin is not yet ready.
Also, I don't add comments here since it's not just this API but others like AddApplication that need to be revised later, too. The change here isn't caused by an API change but by an internal store interface change, so fewer comments are okay. We have to revise all the pipette commands later, so I think a comment is not needed.

Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

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

LGTM

@khanhtc1202 khanhtc1202 merged commit 7d2818a into master Feb 10, 2025
16 of 18 checks passed
@khanhtc1202 khanhtc1202 deleted the update-web-api-1 branch February 10, 2025 03:47
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.

3 participants