diff --git a/images/linux/scripts/installers/kind.sh b/images/linux/scripts/installers/kind.sh index 59696906a..4fc7c0d42 100644 --- a/images/linux/scripts/installers/kind.sh +++ b/images/linux/scripts/installers/kind.sh @@ -6,12 +6,10 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh # Install KIND -KIND_VERSION="v0.7.0" - -curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" +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 chmod +x /usr/local/bin/kind # Run tests to determine that the software installed as expected diff --git a/images/win/scripts/Installers/Install-Kind.ps1 b/images/win/scripts/Installers/Install-Kind.ps1 index 12f0caa04..0e97cc04b 100644 --- a/images/win/scripts/Installers/Install-Kind.ps1 +++ b/images/win/scripts/Installers/Install-Kind.ps1 @@ -3,37 +3,38 @@ ## Desc: Install Kind ################################################################################ -$stableKindTag = "v0.7.0" -$tagToUse = $stableKindTag; -$destFilePath = "C:\ProgramData\kind" +function Get-LatestRelease +{ + $url = 'https://api.github.com/repos/kubernetes-sigs/kind/releases/latest' + (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "kind-windows-amd64" +} try { - $kindUrl = "https://github.com/kubernetes-sigs/kind/releases/download/$tagToUse/kind-windows-amd64" - - Write-Host "Downloading kind.exe..." - New-Item -Path $destFilePath -ItemType Directory -Force + Write-Host "Starting Install kind.exe..." + $destFilePath = "C:\ProgramData\kind" + $null = New-Item -Path $destFilePath -ItemType Directory -Force + $kindUrl = Get-LatestRelease $kindInstallerPath = Start-DownloadWithRetry -Url $kindUrl -Name "kind.exe" -DownloadPath $destFilePath - Write-Host "Starting Install kind.exe..." $process = Start-Process -FilePath $kindInstallerPath -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0 -or $exitCode -eq 3010) { - Write-Host -Object 'Installation successful' + Write-Host 'Installation successful' Add-MachinePathItem $destFilePath } 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 } } catch { - Write-Host -Object "Failed to install the Executable kind.exe" - Write-Host -Object $_.Exception.Message - exit -1 + Write-Host "Failed to install the Executable kind.exe" + Write-Host $_.Exception.Message + exit 1 }