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

Support for version service #85969

Closed
alisonelizabeth opened this issue Dec 15, 2020 · 3 comments
Closed

Support for version service #85969

alisonelizabeth opened this issue Dec 15, 2020 · 3 comments
Labels
discuss enhancement New value added to drive a business result Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@alisonelizabeth
Copy link
Contributor

Kibana has several places where the code diverges between master and 7.x. A good example of this is Upgrade Assistant, although there are other plugins such as Snapshot & Restore and Index Management (others?) where this applies as well.

We propose the core team creates a “version” service that can be used to address this problem. We can use the version number specified in the package.json as the source of truth.

Example usage:

if (version.before(Version.V_8_0_0)) {
  // allow deprecated functionality to proceed
} else {
   throw new Error('this is not unsupported');
}

For more background, see: #78923.

@alisonelizabeth alisonelizabeth added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc enhancement New value added to drive a business result labels Dec 15, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet
Copy link
Contributor

The version is currently available via PluginInitializerContext.env.packageInfo.version

Comparing can easily be achieved using the semver package

import Semver from 'semver';
Semver.lt(ctx.env.packageInfo.version, '8.0.0')

I agree that such service would add some sugar around that, but the value gain seems small. Or do you foresee see any other API addition later on this version service?

@alisonelizabeth
Copy link
Contributor Author

Thanks for pointing this out @pgayvallet! I was not aware of this. I think this will serve our needs for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss enhancement New value added to drive a business result Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants