Fixed pre-commit to be installer in monkey dir during deployment scripts

This commit is contained in:
VakarisZ 2021-04-07 14:39:36 +03:00 committed by Mike Salvatore
parent a5ce373cbf
commit 1cc2dc24ac
1 changed files with 4 additions and 2 deletions

View File

@ -10,9 +10,10 @@ param(
$agents = $true $agents = $true
) )
function Configure-precommit([String] $python_command) function Configure-precommit([String] $git_repo_dir)
{ {
Write-Output "Installing pre-commit and setting up pre-commit hook" Write-Output "Installing pre-commit and setting up pre-commit hook"
Push-Location $git_repo_dir
python -m pip install pre-commit python -m pip install pre-commit
if ($LastExitCode) { if ($LastExitCode) {
exit exit
@ -21,6 +22,7 @@ function Configure-precommit([String] $python_command)
if ($LastExitCode) { if ($LastExitCode) {
exit exit
} }
Pop-Location
Write-Output "Pre-commit successfully installed" Write-Output "Pre-commit successfully installed"
} }
@ -134,7 +136,7 @@ function Deploy-Windows([String] $monkey_home = (Get-Item -Path ".\").FullName,
$scoutsuiteRequirements = Join-Path -Path $monkey_home -ChildPath $SCOUTSUITE_DIR | Join-Path -ChildPath "\requirements.txt" $scoutsuiteRequirements = Join-Path -Path $monkey_home -ChildPath $SCOUTSUITE_DIR | Join-Path -ChildPath "\requirements.txt"
& python -m pip install --user -r $scoutsuiteRequirements & python -m pip install --user -r $scoutsuiteRequirements
Configure-precommit Configure-precommit($monkey_home)
$user_python_dir = cmd.exe /c 'py -m site --user-site' $user_python_dir = cmd.exe /c 'py -m site --user-site'
$user_python_dir = Join-Path (Split-Path $user_python_dir) -ChildPath "\Scripts" $user_python_dir = Join-Path (Split-Path $user_python_dir) -ChildPath "\Scripts"