Adds concept of kibanaVersion to plugin installer#8222
Adds concept of kibanaVersion to plugin installer#8222BigFunger merged 2 commits intoelastic:masterfrom
Conversation
|
I'm working on some similar version-comparison logic, but the rules for satisfying the version requirements are slightly more complex. Because of that, I don't think it's worth reusing my code here, but I thought I should cross-link anyway in case you're interested: #8229 |
|
@cjcenizal Yeah, we draw a much harder line for plugin versions than we do with ES/Kibana since we don't necessarily control the code of the plugin itself, so we can't make assumptions about compatibility. |
|
|
||
| export function assertVersion(settings) { | ||
| if (!settings.plugins[0].version) { | ||
| if (!settings.plugins[0].kibanaVersion) { |
There was a problem hiding this comment.
This error can also be solved by adding a kibana.version property, right? We should probably update the Error to state something along these lines: "Plugin package.json is missing both a version property (required) and a kibana.version property (optional)."
|
This is looking good! I have a few comments:
|
|
I still think that |
99f2737 to
89db806
Compare
|
LGTM! |
89db806 to
901fde5
Compare
There was a problem hiding this comment.
Shouldn't the tests be checking both version and kibanaVersion? As in, one set for only kibanaVersion and another for version?
There was a problem hiding this comment.
This is slightly confusing....
const settings = {
workingPath: testWorkingPath,
tempArchiveFile: tempArchiveFilePath,
plugin: 'test-plugin',
version: '5.0.0-SNAPSHOT',
plugins: [ { name: 'foo', path: join(testWorkingPath, 'foo'), kibanaVersion: '5.0.0-SNAPSHOT' } ]
};
the version property here refers to Kibana's actual version as defined by kibana's package.json
There was a problem hiding this comment.
So apparently kibanaVersion is derived, and I should have spent more time digging into the changes here. So this is fine.
|
Tested with x-plugins: Then added a mismatched Functionality looks good. |
src/cli_plugin/install/pack.js
Outdated
There was a problem hiding this comment.
You can use pkg.kibanaVersion = _.get(packageInfo, 'kibana.version', pkg.version); and get rid of the check below.
|
Small change, otherwise LGTM! |
901fde5 to
29f58a1
Compare
|
Backported to 5.x and 5.0, though I forgot to amend the commit on 5.0 to link back up to this PR: a691874 |
backports elastic#8222 to 5.x Former-commit-id: 3a96d98
Closes #7343
The plugin installer checks the
package.jsonfile of the plugin in the archive. It compares theversionproperty defined there against theversionproperty defined in Kibana'spackage.jsonfile.If the two do not match down to the patch level, the plugin will not be installed. (ignoring everything after a hyphen in the comparison)
This PR keeps that functionality the same.
Now, however, the installer looks for a explicitly defined
kibana.versionproperty and uses that in the comparison if it exists. It falls back to theversionproperty ifkibana.versionis not defined.Example
{ "version": "1.0.4" }will result in the plugin installer comparing
1.0.4during the version check against the Kibana version.{ "version": "1.0.4", "kibana": { "version": "5.0.1" } }will result in the plugin installer comparing
5.0.1during the version check against the Kibana version.