Skip to content

Commit

Permalink
Merge branch '3168-vendor-windows-directory' into develop
Browse files Browse the repository at this point in the history
Issue #3168
PR #3288
  • Loading branch information
mssalvatore committed May 3, 2023
2 parents 529fbd4 + 8ee8970 commit ad09d9f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
9 changes: 7 additions & 2 deletions monkey/agent_plugins/build_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

pushd "$PLUGIN_PATH" || fail "$PLUGIN_PATH does not exist"
VENDOR_DIR=vendor
if [ -d "src/vendor-windows" ]; then
VENDOR_DIR=vendor-linux
fi

pip install pipenv
pipenv requirements >> requirements.txt
pip install -r requirements.txt -t src/vendor
pip install -r requirements.txt -t src/$VENDOR_DIR
rm requirements.txt

# Package everything up
Expand All @@ -32,7 +37,7 @@ pushd "$PLUGIN_PATH/src" || fail "$PLUGIN_PATH/src does not exist"
source_archive=$PLUGIN_PATH/$SOURCE_FILENAME
tar -cf "$source_archive" --exclude __pycache__ --exclude .mypy_cache --exclude .pytest_cache --exclude .git --exclude .gitignore --exclude .DS_Store -- *

rm -rf vendor
rm -rf vendor*
popd || exit 1

plugin_filename=$(get_plugin_filename) || fail "Failed to get plugin filename: $plugin_filename"
Expand Down
32 changes: 32 additions & 0 deletions monkey/agent_plugins/build_windows_vendor_directory.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
param(
[Parameter(Mandatory = $true)] [string]$workspace,
[Parameter(Mandatory = $true)] [string]$plugin_type,
[Parameter(Mandatory = $true)] [string]$plugin_directory_name
)
Set-PSDebug -Trace 1

$plugin_path = Join-Path -Path $workspace -ChildPath "\monkey\monkey\agent_plugins\$plugin_type\$plugin_directory_name"

Write-Output "Building Windows vendor directory"

Set-Location $plugin_path

Remove-Item $plugin_path\venv -Recurse -Force
& python -m venv "$plugin_path\venv"
& "$plugin_path\venv\Scripts\Activate.ps1"

Write-Output "Python version: $(python --version)"
python -m pip install --upgrade pip
python -m pip install pipenv

pipenv sync

pipenv requirements >> requirements.txt
pip install -r requirements.txt -t src/vendor-windows
rm requirements.txt

#exit venv
deactivate

Compress-Archive -Path "$plugin_path\src\vendor-windows" -Destination "$workspace\vendor-windows.zip"
Remove-Item $plugin_path\venv -Recurse -Force

0 comments on commit ad09d9f

Please sign in to comment.