Files
kubescape/docs/providers/install.ps1
Amir Malka 592e0e2b43 Service discovery (#1359)
* remove hardcoded urls

Signed-off-by: Amir Malka <amirm@armosec.io>

* update

Signed-off-by: Amir Malka <amirm@armosec.io>

* fix test

Signed-off-by: Amir Malka <amirm@armosec.io>

* update providers docs

Signed-off-by: Amir Malka <amirm@armosec.io>

* fix

Signed-off-by: Amir Malka <amirm@armosec.io>

* hardcoded systests branch

Signed-off-by: Amir Malka <amirm@armosec.io>

* fix

Signed-off-by: Amir Malka <amirm@armosec.io>

* added logs

Signed-off-by: Amir Malka <amirm@armosec.io>

* added logs

Signed-off-by: Amir Malka <amirm@armosec.io>

* create config path if it does not exist

Signed-off-by: Amir Malka <amirm@armosec.io>

* fix

Signed-off-by: Amir Malka <amirm@armosec.io>

* fix

Signed-off-by: Amir Malka <amirm@armosec.io>

---------

Signed-off-by: Amir Malka <amirm@armosec.io>
2023-08-30 09:54:50 +03:00

40 lines
1.5 KiB
PowerShell

Write-Host "Installing Kubescape..." -ForegroundColor Cyan
$BASE_DIR=$env:USERPROFILE + "\.kubescape"
$packageName = "/kubescape.exe"
# Get latest release url
$config = Invoke-WebRequest "https://api.github.com/repos/kubescape/kubescape/releases/latest" | ConvertFrom-Json
$url = $config.html_url.Replace("/tag/","/download/")
$fullUrl = $url + $packageName
# Create a new directory if needed
New-Item -Path $BASE_DIR -ItemType "directory" -ErrorAction SilentlyContinue
# Download the binary
$useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5)
if ($useBitTransfer)
{
Write-Information -MessageData 'Using a fallback BitTransfer method since you are running Windows PowerShell'
Start-BitsTransfer -Source $fullUrl -Destination $BASE_DIR\kubescape.exe
}
else
{
Invoke-WebRequest -Uri $fullUrl -OutFile $BASE_DIR\kubescape.exe
}
# Update user PATH if needed
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if (-not $currentPath.Contains($BASE_DIR)) {
$confirmation = Read-Host "Add kubescape to user path? (y/n)"
if ($confirmation -eq 'y') {
$env:Path=[Environment]::GetEnvironmentVariable("Path", "User") + ";$BASE_DIR;"
[Environment]::SetEnvironmentVariable("Path", "${env:Path}", "User")
}
}
Write-Host "Finished Installation.`n" -ForegroundColor Green
Write-Host "Executing Kubescape.`n" -ForegroundColor Green
kubescape scan --server api.armosec.io