-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Adds concept of kibanaVersion to plugin installer #8222
Adds concept of kibanaVersion to plugin installer #8222
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. |
@@ -46,14 +46,14 @@ export async function rebuildCache(settings, logger) { | |||
} | |||
|
|||
export function assertVersion(settings) { | |||
if (!settings.plugins[0].version) { | |||
if (!settings.plugins[0].kibanaVersion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -45,7 +45,7 @@ describe('kibana cli', function () { | |||
tempArchiveFile: tempArchiveFilePath, | |||
plugin: 'test-plugin', | |||
version: '5.0.0-SNAPSHOT', | |||
plugins: [ { name: 'foo', path: join(testWorkingPath, 'foo'), version: '5.0.0-SNAPSHOT' } ] | |||
plugins: [ { name: 'foo', path: join(testWorkingPath, 'foo'), kibanaVersion: '5.0.0-SNAPSHOT' } ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
// the version of kibana down to the patch level. If these two versions need | ||
// to diverge, they can specify a kibana.version to indicate the version of | ||
// kibana the plugin is intended to work with. | ||
pkg.kibanaVersion = _.get(packageInfo, 'kibana.version'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use pkg.kibanaVersion = _.get(packageInfo, 'kibana.version', pkg.version);
and get rid of the check below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet.
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.json
file of the plugin in the archive. It compares theversion
property defined there against theversion
property defined in Kibana'spackage.json
file.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.version
property and uses that in the comparison if it exists. It falls back to theversion
property ifkibana.version
is not defined.Example
will result in the plugin installer comparing
1.0.4
during the version check against the Kibana version.will result in the plugin installer comparing
5.0.1
during the version check against the Kibana version.