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

插件安装和升级支持版本校验 #3089

Closed
ruibaby opened this issue Dec 30, 2022 · 1 comment · Fixed by #3114
Closed

插件安装和升级支持版本校验 #3089

ruibaby opened this issue Dec 30, 2022 · 1 comment · Fixed by #3114
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Milestone

Comments

@ruibaby
Copy link
Member

ruibaby commented Dec 30, 2022

你当前使用的版本

2.1.0

描述一下此特性

目前插件的 plugin.yaml 虽然有 requires 字段,但目前在安装或者升级插件的时候没有校验版本号是否与当前 Halo 版本匹配,期望支持。

/kind feature
/area core
/milestone 2.2.x

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 30, 2022
@f2c-ci-robot f2c-ci-robot bot added this to the 2.2.x milestone Dec 30, 2022
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Dec 30, 2022
@ruibaby ruibaby added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Jan 3, 2023
@guqing
Copy link
Member

guqing commented Jan 6, 2023

/assign

f2c-ci-robot bot pushed a commit that referenced this issue Jan 13, 2023
#### What type of PR is this?
/kind feature
/area core
/milestone 2.2.x

#### What this PR does / why we need it:
插件安装和升级支持版本校验

BTW: 此 PR 中 PluginReconciler 有一些异常提示是没有加 i18n 的,主要是考虑 Reconciler 与请求不挂钩,无法获取到 request 上下文的 Locale,如果用 Locale.getDefault() 那么后续用户切换语言时也更改不到已经持久化到数据库中的错误信息,可能得靠客户端翻译异常。

参考文档:
- [semver-expressions-api-ranges](https://github.com/zafarkhaja/jsemver#semver-expressions-api-ranges)
- [integrating-with-actuator.build-info](https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#integrating-with-actuator.build-info)
- [BuildInfoContributor](https://github.com/spring-projects/spring-boot/blob/v3.0.1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/BuildInfoContributor.java)

#### Which issue(s) this PR fixes:
Fixes #3089

#### Special notes for your reviewer:
how to test it?
- 开发模式下不会校验插件填写的 requires,但通过接口安装和升级都会统一校验。
- 在 deployment 模式下安装插件和升级插件会根据 halo 的版本校验插件的 spec.requires 是否符合要求,参考 [semver-expressions-api-ranges](https://github.com/zafarkhaja/jsemver#semver-expressions-api-ranges)。
- 如果 spec.requires 为 `*` 则表示允许所有,如果填写为具体的版本号,例如 requires: "2.2.0" 则隐式表示为 `>=2.2.0`。

可以测试这几种情况是否符合期望。

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
插件安装和升级支持版本校验
```
@ruibaby ruibaby modified the milestones: 2.2.x, 2.2.0 Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/feature Categorizes issue or PR as related to a new feature. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants