diff --git a/scripts/components/OpenSearch-Dashboards/build.sh b/scripts/components/OpenSearch-Dashboards/build.sh index cda727c8b1..fadd1cbbf1 100755 --- a/scripts/components/OpenSearch-Dashboards/build.sh +++ b/scripts/components/OpenSearch-Dashboards/build.sh @@ -89,6 +89,13 @@ case $PLATFORM-$DISTRIBUTION-$ARCHITECTURE in EXTRA_PARAMS="--skip-os-packages" SUFFIX="$PLATFORM-arm64" ;; + windows-zip-x64) + TARGET="--all-platforms" + EXT="$DISTRIBUTION" + BUILD_PARAMS="build-platform" + EXTRA_PARAMS="--skip-os-packages" + SUFFIX="$PLATFORM-x64" + ;; linux-rpm-x64) TARGET="--$DISTRIBUTION" EXT="$DISTRIBUTION" @@ -110,8 +117,14 @@ case $PLATFORM-$DISTRIBUTION-$ARCHITECTURE in esac echo "Setting node version" -source $NVM_DIR/nvm.sh -nvm use + +if [ "$PLATFORM" != "windows" ]; then + source $NVM_DIR/nvm.sh + nvm use +else + volta install node@`cat .nvmrc` + volta install yarn +fi echo "Building node modules for core with $PLATFORM-$DISTRIBUTION-$ARCHITECTURE" yarn osd bootstrap diff --git a/src/assemble_workflow/bundle_opensearch_dashboards.py b/src/assemble_workflow/bundle_opensearch_dashboards.py index 1647488c02..3431e94d1d 100644 --- a/src/assemble_workflow/bundle_opensearch_dashboards.py +++ b/src/assemble_workflow/bundle_opensearch_dashboards.py @@ -9,11 +9,16 @@ from assemble_workflow.bundle import Bundle from manifests.build_manifest import BuildComponent +from system.os import current_platform class BundleOpenSearchDashboards(Bundle): + @property + def install_plugin_script(self) -> str: + return "opensearch-dashboards-plugin.bat" if current_platform() == "windows" else "opensearch-dashboards-plugin" + def install_plugin(self, plugin: BuildComponent) -> None: tmp_path = self._copy_component(plugin, "plugins") - cli_path = os.path.join(self.min_dist.archive_path, "bin", "opensearch-dashboards-plugin") + cli_path = os.path.join(self.min_dist.archive_path, "bin", self.install_plugin_script) self._execute(f"{cli_path} --allow-root install file:{tmp_path}") super().install_plugin(plugin) diff --git a/tests/tests_assemble_workflow/test_bundle_opensearch_dashboards.py b/tests/tests_assemble_workflow/test_bundle_opensearch_dashboards.py index 8a7cc062c9..999509e28f 100644 --- a/tests/tests_assemble_workflow/test_bundle_opensearch_dashboards.py +++ b/tests/tests_assemble_workflow/test_bundle_opensearch_dashboards.py @@ -12,6 +12,7 @@ from assemble_workflow.bundle_opensearch_dashboards import BundleOpenSearchDashboards from manifests.build_manifest import BuildManifest from paths.script_finder import ScriptFinder +from system.os import current_platform class TestBundleOpenSearchDashboards(unittest.TestCase): @@ -73,7 +74,8 @@ def test_bundle_install_plugin(self, path_isfile: Mock) -> None: self.assertEqual(mock_copyfile.call_count, 1) self.assertEqual(mock_check_call.call_count, 2) - install_plugin_bin = os.path.join(bundle.min_dist.archive_path, "bin", "opensearch-dashboards-plugin") + script = "opensearch-dashboards-plugin.bat" if current_platform() == "windows" else "opensearch-dashboards-plugin" + install_plugin_bin = os.path.join(bundle.min_dist.archive_path, "bin", script) mock_check_call.assert_has_calls( [ call(