forked from AliyunContainerService/k8s-for-docker-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getLatestIstio.ps1
21 lines (15 loc) · 837 Bytes
/
getLatestIstio.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
param(
[string] $IstioVersion = $(Invoke-RestMethod "https://api.github.com/repos/istio/istio/releases")[0].tag_name
)
$url = "https://github.com/istio/istio/releases/download/$($IstioVersion)/istio-$($IstioVersion)-win.zip"
$Path = Get-Location
$output = [IO.Path]::Combine($Path, "istio-$($IstioVersion)-win.zip")
Write-Host "Downloading Istio from $url to path " $Path -ForegroundColor Green
#Download file
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($url, $output)
# Unzip the Archive
Expand-Archive $output -DestinationPath $Path
#Set the environment variable
$IstioHome = [IO.Path]::Combine($Path, "istio-$($IstioVersion)")
[Environment]::SetEnvironmentVariable("ISTIO_HOME", "$IstioHome", "User")