Skip to content

Conversation

@nakabonne
Copy link
Member

What this PR does / why we need it:
This PR mainly improves appconfigreporter to:

  1. simplify the way to find out registered apps by using the cached app list.
  2. solve the problem of scanning all files under the repository every time to look for unregistered applications, even though no new commits have been created.

For more information about the first one, please visit #2838.
The second one is solved by caching the latest unregistered apps.

Which issue(s) this PR fixes:

Fixes #2838
Close #2837

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

KAPETANIOS

Failed while validating Kapetanios configuration.

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

@nakabonne
Copy link
Member Author

/kapetanios reload

@pipecd-bot
Copy link
Collaborator

KAPETANIOS

@nakabonne: Successfully loaded the latest Kapetanios configuration.

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.63%. This pull request decreases coverage by -0.06%.

File Function Base Head Diff
pkg/app/piped/appconfigreporter/appconfigreporter.go isSynced -- 70.00% +70.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateUnregisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findRegisteredApps 83.33% 100.00% +16.67%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findUnregisteredApps 91.30% 78.57% -12.73%
pkg/config/config.go Config.init 88.00% 92.00% +4.00%
pkg/config/config.go Config.UnmarshalJSON 91.67% 100.00% +8.33%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.scanAppConfigs 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateRegisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go makeGitPathKey 100.00% -- -100.00%

Copy link
Member

@nghialv nghialv left a comment

Choose a reason for hiding this comment

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

Looks neat! Good job!
Just some nits.

Comment on lines 272 to 274
if appInfo.Kind != app.Kind {
return false
}
Copy link
Member

Choose a reason for hiding this comment

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

Changing the Kind could cause unexpected behavior since the application is paired with a Cloud Provider selected while adding the app.
So I think that field should not be allowed to be changed. How do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I feel the same way. Currently changing it via the web client is allowed, but few users use it possibly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied at f05df12

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.63%. This pull request decreases coverage by -0.06%.

File Function Base Head Diff
pkg/app/piped/appconfigreporter/appconfigreporter.go isSynced -- 70.00% +70.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateUnregisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findRegisteredApps 83.33% 100.00% +16.67%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findUnregisteredApps 91.30% 78.57% -12.73%
pkg/config/config.go Config.init 88.00% 92.00% +4.00%
pkg/config/config.go Config.UnmarshalJSON 91.67% 100.00% +8.33%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.scanAppConfigs 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateRegisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go makeGitPathKey 100.00% -- -100.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.63%. This pull request decreases coverage by -0.06%.

File Function Base Head Diff
pkg/app/piped/appconfigreporter/appconfigreporter.go isSynced -- 75.00% +75.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.scanAppConfigs 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateRegisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateUnregisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findRegisteredApps 83.33% 100.00% +16.67%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findUnregisteredApps 91.30% 78.57% -12.73%
pkg/config/config.go Config.init 88.00% 92.00% +4.00%
pkg/config/config.go Config.UnmarshalJSON 91.67% 100.00% +8.33%
pkg/app/piped/appconfigreporter/appconfigreporter.go makeGitPathKey 100.00% -- -100.00%

@nakabonne
Copy link
Member Author

I changed to emit log when kind has been changed

@nghialv
Copy link
Member

nghialv commented Nov 29, 2021

Thank you. So let's remove this too.
https://github.com/pipe-cd/pipe/blob/bb8483359a18c71736a24dac80c5fcbeba154d79/pkg/app/api/grpcapi/piped_api.go#L983

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.63%. This pull request decreases coverage by -0.06%.

File Function Base Head Diff
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.isSynced -- 70.00% +70.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateRegisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateUnregisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findRegisteredApps 83.33% 100.00% +16.67%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findUnregisteredApps 91.30% 78.57% -12.73%
pkg/config/config.go Config.init 88.00% 92.00% +4.00%
pkg/config/config.go Config.UnmarshalJSON 91.67% 100.00% +8.33%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.scanAppConfigs 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go makeGitPathKey 100.00% -- -100.00%

@pipecd-bot
Copy link
Collaborator

TODO

The following ISSUES will be created once got merged. If you want me to skip creating the issue, you can use /todo skip command.

Details

1. Make it possible to follow the ApplicationInfo field changes

https://github.com/pipe-cd/pipe/blob/1acc33ea60aa55e6e99f7da0dcf820238872a11e/pkg/app/piped/appconfigreporter/appconfigreporter.go#L277-L280

This was created by todo plugin since "TODO:" was found in 1acc33e when #2854 was merged. cc: @nakabonne.

@nakabonne
Copy link
Member Author

@nghialv Fixed 👍

@nghialv
Copy link
Member

nghialv commented Nov 29, 2021

Nice. Well done.
/lgtm

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.63%. This pull request decreases coverage by -0.06%.

File Function Base Head Diff
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.isSynced -- 70.00% +70.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findRegisteredApps 83.33% 100.00% +16.67%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.findUnregisteredApps 91.30% 78.57% -12.73%
pkg/config/config.go Config.init 88.00% 92.00% +4.00%
pkg/config/config.go Config.UnmarshalJSON 91.67% 100.00% +8.33%
pkg/app/api/grpcapi/piped_api.go PipedAPI.UpdateApplicationConfigurations 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.scanAppConfigs 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateRegisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go Reporter.updateUnregisteredApps 0.00% 0.00% +0.00%
pkg/app/piped/appconfigreporter/appconfigreporter.go makeGitPathKey 100.00% -- -100.00%

@khanhtc1202
Copy link
Member

Nice work
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by khanhtc1202.

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 295adc5 into master Nov 29, 2021
@pipecd-bot pipecd-bot deleted the refactor-appconfigreporter branch November 29, 2021 03:55
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.

Avoid database from receiving a lot of AppConfig updates when Piped is starting up Consider bulk-updating multiple apps

5 participants