Skip to content

Commit

Permalink
Fix tests on Windows.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@dblock.org>
  • Loading branch information
dblock committed Oct 20, 2021
1 parent 6c90739 commit b94916e
Show file tree
Hide file tree
Showing 62 changed files with 408 additions and 259 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
env:
PYTHON_VERSION: 3.7
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ out.txt

/artifacts/
/bundle/

/.vscode/
11 changes: 9 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- [Forking and Cloning](#forking-and-cloning)
- [Install Prerequisites](#install-prerequisites)
- [Pyenv](#pyenv)
- [Linux/MacOS](#linuxmacos)
- [Python 3.7](#python-37)
- [Pipenv](#pipenv)
- [NVM and Node](#nvm-and-node)
Expand All @@ -24,7 +25,9 @@ Fork this repository on GitHub, and clone locally with `git clone`.

#### Pyenv

Use pyenv to manage multiple versions of Python. This can be installed with [pyenv-installer](https://github.com/pyenv/pyenv-installer).
##### Linux/MacOS

Use pyenv to manage multiple versions of Python. This can be installed with [pyenv-installer](https://github.com/pyenv/pyenv-installer) on Linux and MacOS, and [pyenv-win](https://github.com/pyenv-win/pyenv-win#installation) on Windows.

```
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
Expand All @@ -42,7 +45,7 @@ Python 3.7.11
If you are using pyenv.

```
pyenv install 3.7.12
pyenv install 3.7.12 # use 3.7.9 on Windows, the latest at the time of writing this
pyenv global 3.7.12
```

Expand All @@ -57,7 +60,10 @@ $ pipenv --version
pipenv, version 19.0
```

On Windows, run `pyenv rehash` if `pipenv` cannot be found. This rehashes pyenv shims, creating a `pipenv` file in `/.pyenv/pyenv-win/shims/`.

#### NVM and Node

Install [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) to use the Node 10.24.1 version as it is required

```
Expand All @@ -66,6 +72,7 @@ nvm install v10.24.1
```

#### Yarn

[Yarn](https://classic.yarnpkg.com/en/docs/install) is required for building and running the OpenSearch Dashboards and plugins

```
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sortedcontainers = "*"
cerberus = "~=1.3.4"
psutil = "~=5.8"
semantic-version = "~=2.8.5"
atomicwrites = "*"

[dev-packages]

Expand Down
103 changes: 60 additions & 43 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/assemble_workflow/bundle_opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
class BundleOpenSearch(Bundle):
def install_plugin(self, plugin):
tmp_path = self._copy_component(plugin, "plugins")
cli_path = os.path.join(self.archive_path, "bin/opensearch-plugin")
cli_path = os.path.join(self.archive_path, "bin", "opensearch-plugin")
self._execute(f"{cli_path} install --batch file:{tmp_path}")
super().install_plugin(plugin)
2 changes: 1 addition & 1 deletion src/assemble_workflow/bundle_opensearch_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
class BundleOpenSearchDashboards(Bundle):
def install_plugin(self, plugin):
tmp_path = self._copy_component(plugin, "plugins")
cli_path = os.path.join(self.archive_path, "bin/opensearch-dashboards-plugin")
cli_path = os.path.join(self.archive_path, "bin", "opensearch-dashboards-plugin")
self._execute(f"{cli_path} --allow-root install file:{tmp_path}")
super().install_plugin(plugin)
3 changes: 2 additions & 1 deletion src/build_workflow/build_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import argparse
import logging
import os
import sys


Expand Down Expand Up @@ -48,7 +49,7 @@ def __init__(self):
self.snapshot = args.snapshot
self.component = args.component
self.keep = args.keep
self.script_path = sys.argv[0].replace("/src/run_build.py", "/build.sh")
self.script_path = sys.argv[0].replace(os.path.sep + os.path.join("src", "run_build.py"), f"{os.path.sep}build.sh")

def component_command(self, name):
return " ".join(
Expand Down
3 changes: 2 additions & 1 deletion src/ci_workflow/ci_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import argparse
import logging
import os
import sys


Expand Down Expand Up @@ -45,7 +46,7 @@ def __init__(self):
self.component = args.component
self.keep = args.keep
self.logging_level = args.logging_level
self.script_path = sys.argv[0].replace("/src/run_ci.py", "/ci.sh")
self.script_path = sys.argv[0].replace(os.path.sep + os.path.join("src", "run_ci.py"), f"{os.path.sep}ci.sh")

def component_command(self, name):
return " ".join(
Expand Down
15 changes: 7 additions & 8 deletions src/git/git_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ def __init__(self, url, ref, directory=None, working_subdirectory=None):
self.temp_dir = None
self.dir = directory
os.makedirs(self.dir, exist_ok=False)

self.working_subdirectory = working_subdirectory
self.__checkout__()

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, exc_traceback):
if self.temp_dir:
self.temp_dir.__exit__(exc_type, exc_value, exc_traceback)

def __checkout__(self):
# Check out the repository
self.execute_silent("git init", self.dir)
Expand All @@ -42,13 +48,6 @@ def __checkout__(self):
self.sha = self.output("git rev-parse HEAD", self.dir)
logging.info(f"Checked out {self.url}@{self.ref} into {self.dir} at {self.sha}")

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, exc_traceback):
if self.temp_dir:
self.temp_dir.__exit__(exc_type, exc_value, exc_traceback)

@property
def working_directory(self):
if self.working_subdirectory:
Expand Down
2 changes: 1 addition & 1 deletion src/manifests/build_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
build:
name: string
version: string
platform: linux or darwin
platform: linux, darwin or windows
architecture: x64 or arm64
components:
- name: string
Expand Down
2 changes: 1 addition & 1 deletion src/manifests/bundle_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BundleManifest(Manifest):
build:
name: string
version: string
platform: linux or darwin
platform: linux, darwin or windows
architecture: x64 or arm64
location: /relative/path/to/tarball
components:
Expand Down
2 changes: 1 addition & 1 deletion src/manifests/input_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class InputManifests(Manifests):
def __init__(self):
files = glob.glob(os.path.join(self.manifests_path, "**/opensearch-*.yml"))
# there's an opensearch-1.0.0-maven.yml that we want to skip
files = [f for f in files if re.search(r"/opensearch-([0-9.]*)\.yml$", f)]
files = [f for f in files if re.search(r"[\\/]opensearch-([0-9.]*)\.yml$", f)]
super().__init__(InputManifest, files)
Loading

0 comments on commit b94916e

Please sign in to comment.