Update to latest kind version (#954)

This commit is contained in:
Aleksandr Chebotov
2020-05-28 19:30:28 +03:00
committed by GitHub
parent 8290bdeb6e
commit 9b76f6f84b
2 changed files with 16 additions and 17 deletions

View File

@@ -6,12 +6,10 @@
# Source the helpers for use with the script # Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
# Install KIND # Install KIND
KIND_VERSION="v0.7.0" URL=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kind-linux-amd64"))')
curl -L -o /usr/local/bin/kind $URL
curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64"
chmod +x /usr/local/bin/kind chmod +x /usr/local/bin/kind
# Run tests to determine that the software installed as expected # Run tests to determine that the software installed as expected

View File

@@ -3,37 +3,38 @@
## Desc: Install Kind ## Desc: Install Kind
################################################################################ ################################################################################
$stableKindTag = "v0.7.0" function Get-LatestRelease
$tagToUse = $stableKindTag; {
$destFilePath = "C:\ProgramData\kind" $url = 'https://api.github.com/repos/kubernetes-sigs/kind/releases/latest'
(Invoke-RestMethod -Uri $url).assets.browser_download_url -match "kind-windows-amd64"
}
try try
{ {
$kindUrl = "https://github.com/kubernetes-sigs/kind/releases/download/$tagToUse/kind-windows-amd64" Write-Host "Starting Install kind.exe..."
$destFilePath = "C:\ProgramData\kind"
Write-Host "Downloading kind.exe..." $null = New-Item -Path $destFilePath -ItemType Directory -Force
New-Item -Path $destFilePath -ItemType Directory -Force
$kindUrl = Get-LatestRelease
$kindInstallerPath = Start-DownloadWithRetry -Url $kindUrl -Name "kind.exe" -DownloadPath $destFilePath $kindInstallerPath = Start-DownloadWithRetry -Url $kindUrl -Name "kind.exe" -DownloadPath $destFilePath
Write-Host "Starting Install kind.exe..."
$process = Start-Process -FilePath $kindInstallerPath -Wait -PassThru $process = Start-Process -FilePath $kindInstallerPath -Wait -PassThru
$exitCode = $process.ExitCode $exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 3010) if ($exitCode -eq 0 -or $exitCode -eq 3010)
{ {
Write-Host -Object 'Installation successful' Write-Host 'Installation successful'
Add-MachinePathItem $destFilePath Add-MachinePathItem $destFilePath
} }
else else
{ {
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." Write-Host "Non zero exit code returned by the installation process : $exitCode."
exit $exitCode exit $exitCode
} }
} }
catch catch
{ {
Write-Host -Object "Failed to install the Executable kind.exe" Write-Host "Failed to install the Executable kind.exe"
Write-Host -Object $_.Exception.Message Write-Host $_.Exception.Message
exit -1 exit 1
} }