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

Refactor plugin reconciliation for dependency mechanism #5900

Merged
merged 4 commits into from
May 27, 2024

Conversation

JohnNiang
Copy link
Member

What type of PR is this?

/kind improvement
/area core
/area plugin

What this PR does / why we need it:

This PR wholly refactors plugin reconciliation to implement dependency mechanism.

Currently,

  • If we disable plugin which has dependents, the plugin must wait for dependents to be disabled.
  • If we enable plugin which has dependencies , the plugin must wait for dependencies to be enabled.
  • If we upgrade plugin which has dependents, the plugin must request dependents to be unloaded. After the plugin is unloaded, the plugin must cancel unload request for dependents.

Which issue(s) this PR fixes:

Fixes #5872

Special notes for your reviewer:

Does this PR introduce a user-facing change?

优化被依赖的插件的升级,启用和禁用

@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/improvement Categorizes issue or PR as related to a improvement. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 13, 2024
@f2c-ci-robot f2c-ci-robot bot requested a review from guqing May 13, 2024 03:42
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label May 13, 2024
@f2c-ci-robot f2c-ci-robot bot requested a review from wan92hen May 13, 2024 03:42
@f2c-ci-robot f2c-ci-robot bot added the area/plugin Issues or PRs related to the Plugin Provider label May 13, 2024
@JohnNiang JohnNiang changed the title WIP: Refactor plugin reconciliation for dependency mechanism Refactor plugin reconciliation for dependency mechanism May 20, 2024
@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2024
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 45.68966% with 189 lines in your changes are missing coverage. Please review.

Project coverage is 55.97%. Comparing base (5fdf6c0) to head (a94a0ec).
Report is 204 commits behind head on main.

Files Patch % Lines
...pp/core/extension/reconciler/PluginReconciler.java 52.20% 115 Missing and 15 partials ⚠️
...core/extension/service/impl/PluginServiceImpl.java 35.41% 27 Missing and 4 partials ⚠️
...rc/main/java/run/halo/app/infra/ConditionList.java 0.00% 12 Missing ⚠️
...ception/PluginDependenciesNotEnabledException.java 0.00% 6 Missing ⚠️
...xception/PluginDependentsNotDisabledException.java 0.00% 6 Missing ⚠️
...pi/src/main/java/run/halo/app/infra/Condition.java 0.00% 2 Missing ⚠️
.../main/java/run/halo/app/core/extension/Plugin.java 0.00% 1 Missing ⚠️
...lo/app/core/extension/endpoint/PluginEndpoint.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5900      +/-   ##
============================================
- Coverage     56.91%   55.97%   -0.94%     
- Complexity     3319     3501     +182     
============================================
  Files           587      618      +31     
  Lines         18968    20914    +1946     
  Branches       1401     1461      +60     
============================================
+ Hits          10795    11707     +912     
- Misses         7594     8615    +1021     
- Partials        579      592      +13     

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

@JohnNiang JohnNiang force-pushed the refactor/plugin-dependencies branch 2 times, most recently from 34b5721 to 22f2d09 Compare May 22, 2024 08:38
@JohnNiang JohnNiang force-pushed the refactor/plugin-dependencies branch from a045d17 to 47a4ce4 Compare May 24, 2024 07:17
@guqing
Copy link
Member

guqing commented May 24, 2024

建议为 plugin-state API 加一个前置的依赖检查,如果有依赖没有启动直接报错否则前端会一直 pending 而用户不知道为什么

Signed-off-by: JohnNiang <johnniang@foxmail.com>
@JohnNiang JohnNiang force-pushed the refactor/plugin-dependencies branch from c16bd9b to 500e4dd Compare May 24, 2024 16:39
Copy link

sonarcloud bot commented May 27, 2024

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.3% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label May 27, 2024
@ruibaby ruibaby added this to the 2.16.x milestone May 27, 2024
Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

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

/approve

Copy link

f2c-ci-robot bot commented May 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 27, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit 5df51bb into halo-dev:main May 27, 2024
8 checks passed
@JohnNiang JohnNiang removed this from the 2.16.x milestone May 27, 2024
@JohnNiang JohnNiang added this to the 2.16.0 milestone May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

建议重构插件依赖相关的插件启动逻辑
3 participants