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

Add windows specific plugin installation for dashboards #2730

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions scripts/components/OpenSearch-Dashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/assemble_workflow/bundle_opensearch_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down