Skip to content

Commit

Permalink
[Build] use saved config from valid kbn version (#485)
Browse files Browse the repository at this point in the history
OpenSearch Dashboards supports restart upgrades from Kibana 6.8.0
through Kibana 7.10.2 and to OpenSearch Dashboards 1.0. Noting that
the semantic version of the application went from high to low. The
application would check if the config saved had a version less than
or equal to the current version. If not then it would skip migrating
the settings to the current version.

This updates enables to migrate settings from Kibana 6.8.0 through
7.10.2 if and only if the current version of OpenSearch Dashboards
is 1.0.0.

Issues partially resolved:
#334

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Jun 21, 2021
1 parent a947fdf commit 66bbe12
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,30 @@ describe('savedObjects/health_check/isConfigVersionUpgradeable', function () {
isUpgradeableTest('50.0.10-rc150-SNAPSHOT', '50.0.9', false);
isUpgradeableTest(undefined as any, '7.4.0', false);
isUpgradeableTest('@@version', '7.4.0', false);
isUpgradeableTest('6.8.0', '1.0.0', true);
isUpgradeableTest('7.0.0', '1.0.0', true);
isUpgradeableTest('7.10.2', '1.0.0', true);
isUpgradeableTest('6.8.0-rc1', '1.0.0', true);
isUpgradeableTest('7.0.0-rc1', '1.0.0', true);
isUpgradeableTest('7.10.2-rc1', '1.0.0', true);
isUpgradeableTest('6.8.0', '1.0.0-rc1', true);
isUpgradeableTest('7.0.0', '1.0.0-rc1', true);
isUpgradeableTest('7.10.2', '1.0.0-rc1', true);
isUpgradeableTest('6.7.10', '1.0.0', false);
isUpgradeableTest('7.10.3', '1.0.0', false);
isUpgradeableTest('6.7.10-rc1', '1.0.0', false);
isUpgradeableTest('7.10.3-rc1', '1.0.0', false);
isUpgradeableTest('6.7.10', '1.0.0-rc1', false);
isUpgradeableTest('7.10.3', '1.0.0-rc1', false);
isUpgradeableTest('6.8.0', '1.0.1', false);
isUpgradeableTest('7.0.0', '1.0.1', false);
isUpgradeableTest('7.10.2', '1.0.1', false);
isUpgradeableTest('6.8.0-rc1', '1.0.1', false);
isUpgradeableTest('7.0.0-rc1', '1.0.1', false);
isUpgradeableTest('7.10.2-rc1', '1.0.1', false);
isUpgradeableTest('6.8.0', '1.0.1-rc1', false);
isUpgradeableTest('7.0.0', '1.0.1-rc1', false);
isUpgradeableTest('7.10.2', '1.0.1-rc1', false);
isUpgradeableTest('1.0.0-rc1', '1.0.0', true);
isUpgradeableTest('1.0.1', '1.0.0', false);
});
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ export function isConfigVersionUpgradeable(
opensearchDashboardsReleaseVersion
);
const savedRcIsLessThanOpenSearchDashboards = savedRcNumber < opensearchDashboardsRcNumber;
// If the saved config is from the fork and from 6.8.0 to 7.10.2 then we should be able to upgrade.
const savedIsFromPrefork =
semver.gte(savedReleaseVersion, '6.8.0') && semver.lte(savedReleaseVersion, '7.10.2');
const currentVersionIsVersion1 = semver.eq(opensearchDashboardsReleaseVersion, '1.0.0');
return (
savedIsLessThanOpenSearchDashboards ||
(savedIsSameAsOpenSearchDashboards && savedRcIsLessThanOpenSearchDashboards)
(savedIsSameAsOpenSearchDashboards && savedRcIsLessThanOpenSearchDashboards) ||
(savedIsFromPrefork && currentVersionIsVersion1)
);
}

0 comments on commit 66bbe12

Please sign in to comment.