File tree Expand file tree Collapse file tree 6 files changed +78
-0
lines changed Expand file tree Collapse file tree 6 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 32
32
Stop-Service kubelet -Force -ErrorAction SilentlyContinue
33
33
Stop-Service containerd -Force
34
34
echo "downloading containerd: $$CONTAINERD_URL"
35
+ # If the URL is set to "latest", we will query the GitHub API for the latest containerd release
36
+ if ($$CONTAINERD_URL.ToLower() -eq "latest") {
37
+ # Query GitHub API for latest containerd release for Windows
38
+ $githubApiUrl = "https://api.github.com/repos/containerd/containerd/releases/latest"
39
+ Write-Output "Fetching latest containerd release from GitHub..."
40
+ $releaseInfo = Invoke-RestMethod -Uri $githubApiUrl -UseBasicParsing
41
+ $asset = $releaseInfo.assets | Where-Object { $_.name -like "*windows-amd64.tar.gz" } | Select-Object -First 1
42
+ if ($null -eq $asset) {
43
+ Write-Output "Could not find a Windows containerd release asset in the latest GitHub release."
44
+ exit 1
45
+ }
46
+ $$CONTAINERD_URL = $asset.browser_download_url
47
+ }
35
48
curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz"
36
49
# Log service state and if any files under containerd director are locked
37
50
Get-Service -Name containerd, kubelet
Original file line number Diff line number Diff line change 32
32
Stop-Service kubelet -Force -ErrorAction SilentlyContinue
33
33
Stop-Service containerd -Force
34
34
echo "downloading containerd: $$CONTAINERD_URL"
35
+ # If the URL is set to "latest", we will query the GitHub API for the latest containerd release
36
+ if ($$CONTAINERD_URL.ToLower() -eq "latest") {
37
+ # Query GitHub API for latest containerd release for Windows
38
+ $githubApiUrl = "https://api.github.com/repos/containerd/containerd/releases/latest"
39
+ Write-Output "Fetching latest containerd release from GitHub..."
40
+ $releaseInfo = Invoke-RestMethod -Uri $githubApiUrl -UseBasicParsing
41
+ $asset = $releaseInfo.assets | Where-Object { $_.name -like "*windows-amd64.tar.gz" } | Select-Object -First 1
42
+ if ($null -eq $asset) {
43
+ Write-Output "Could not find a Windows containerd release asset in the latest GitHub release."
44
+ exit 1
45
+ }
46
+ $$CONTAINERD_URL = $asset.browser_download_url
47
+ }
35
48
curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz"
36
49
# Log service state and if any files under containerd director are locked
37
50
Get-Service -Name containerd, kubelet
Original file line number Diff line number Diff line change 32
32
Stop-Service kubelet -Force -ErrorAction SilentlyContinue
33
33
Stop-Service containerd -Force
34
34
echo "downloading containerd: $$CONTAINERD_URL"
35
+ # If the URL is set to "latest", we will query the GitHub API for the latest containerd release
36
+ if ($$CONTAINERD_URL.ToLower() -eq "latest") {
37
+ # Query GitHub API for latest containerd release for Windows
38
+ $githubApiUrl = "https://api.github.com/repos/containerd/containerd/releases/latest"
39
+ Write-Output "Fetching latest containerd release from GitHub..."
40
+ $releaseInfo = Invoke-RestMethod -Uri $githubApiUrl -UseBasicParsing
41
+ $asset = $releaseInfo.assets | Where-Object { $_.name -like "*windows-amd64.tar.gz" } | Select-Object -First 1
42
+ if ($null -eq $asset) {
43
+ Write-Output "Could not find a Windows containerd release asset in the latest GitHub release."
44
+ exit 1
45
+ }
46
+ $$CONTAINERD_URL = $asset.browser_download_url
47
+ }
35
48
curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz"
36
49
# Log service state and if any files under containerd director are locked
37
50
Get-Service -Name containerd, kubelet
Original file line number Diff line number Diff line change 32
32
Stop-Service kubelet -Force -ErrorAction SilentlyContinue
33
33
Stop-Service containerd -Force
34
34
echo "downloading containerd: $$CONTAINERD_URL"
35
+ # If the URL is set to "latest", we will query the GitHub API for the latest containerd release
36
+ if ($$CONTAINERD_URL.ToLower() -eq "latest") {
37
+ # Query GitHub API for latest containerd release for Windows
38
+ $githubApiUrl = "https://api.github.com/repos/containerd/containerd/releases/latest"
39
+ Write-Output "Fetching latest containerd release from GitHub..."
40
+ $releaseInfo = Invoke-RestMethod -Uri $githubApiUrl -UseBasicParsing
41
+ $asset = $releaseInfo.assets | Where-Object { $_.name -like "*windows-amd64.tar.gz" } | Select-Object -First 1
42
+ if ($null -eq $asset) {
43
+ Write-Output "Could not find a Windows containerd release asset in the latest GitHub release."
44
+ exit 1
45
+ }
46
+ $$CONTAINERD_URL = $asset.browser_download_url
47
+ }
35
48
curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz"
36
49
# Log service state and if any files under containerd director are locked
37
50
Get-Service -Name containerd, kubelet
Original file line number Diff line number Diff line change 32
32
Stop-Service kubelet -Force -ErrorAction SilentlyContinue
33
33
Stop-Service containerd -Force
34
34
echo "downloading containerd: $$CONTAINERD_URL"
35
+ # If the URL is set to "latest", we will query the GitHub API for the latest containerd release
36
+ if ($$CONTAINERD_URL.ToLower() -eq "latest") {
37
+ # Query GitHub API for latest containerd release for Windows
38
+ $githubApiUrl = "https://api.github.com/repos/containerd/containerd/releases/latest"
39
+ Write-Output "Fetching latest containerd release from GitHub..."
40
+ $releaseInfo = Invoke-RestMethod -Uri $githubApiUrl -UseBasicParsing
41
+ $asset = $releaseInfo.assets | Where-Object { $_.name -like "*windows-amd64.tar.gz" } | Select-Object -First 1
42
+ if ($null -eq $asset) {
43
+ Write-Output "Could not find a Windows containerd release asset in the latest GitHub release."
44
+ exit 1
45
+ }
46
+ $$CONTAINERD_URL = $asset.browser_download_url
47
+ }
35
48
curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz"
36
49
# Log service state and if any files under containerd director are locked
37
50
Get-Service -Name containerd, kubelet
Original file line number Diff line number Diff line change 32
32
Stop-Service kubelet -Force -ErrorAction SilentlyContinue
33
33
Stop-Service containerd -Force
34
34
echo "downloading containerd: $$CONTAINERD_URL"
35
+ # If the URL is set to "latest", we will query the GitHub API for the latest containerd release
36
+ if ($$CONTAINERD_URL.ToLower() -eq "latest") {
37
+ # Query GitHub API for latest containerd release for Windows
38
+ $githubApiUrl = "https://api.github.com/repos/containerd/containerd/releases/latest"
39
+ Write-Output "Fetching latest containerd release from GitHub..."
40
+ $releaseInfo = Invoke-RestMethod -Uri $githubApiUrl -UseBasicParsing
41
+ $asset = $releaseInfo.assets | Where-Object { $_.name -like "*windows-amd64.tar.gz" } | Select-Object -First 1
42
+ if ($null -eq $asset) {
43
+ Write-Output "Could not find a Windows containerd release asset in the latest GitHub release."
44
+ exit 1
45
+ }
46
+ $$CONTAINERD_URL = $asset.browser_download_url
47
+ }
35
48
curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz"
36
49
# Log service state and if any files under containerd director are locked
37
50
Get-Service -Name containerd, kubelet
You can’t perform that action at this time.
0 commit comments