Skip to content

Commit 0b7fe7c

Browse files
committed
Test release
1 parent de21a85 commit 0b7fe7c

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = v1.109.0
1+
VERSION = v1.110.0
22
LATEST_RELEASE_TAG=$(shell git describe --tags --abbrev=0)
33
LATEST_COMMIT_HASH=$(shell git rev-parse HEAD)
44
LATEST_COMMIT_CHART_VERSION=$(shell git --no-pager show ${LATEST_COMMIT_HASH}:config/helm/aws-node-termination-handler/Chart.yaml | grep 'version:' | cut -d' ' -f2 | tr -d '[:space:]')

scripts/upload-resources-to-github-windows.ps1

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ param(
55
[switch]$K8sAssetsOnly
66
)
77

8-
#$ErrorActionPreference = "Stop"
9-
10-
# # Function to handle errors and cleanup any partially uploaded assets
11-
# function HandleErrorsAndCleanup {
12-
# param (
13-
# [int]$ExitCode
14-
# )
15-
# if ($ExitCode -eq 0) {
16-
# exit 0
17-
# }
18-
# if ($global:AssetIdsUploaded.Count -ne 0) {
19-
# Write-Output "`nCleaning up assets uploaded in the current execution of the script"
20-
# foreach ($assetId in $global:AssetIdsUploaded) {
21-
# Write-Output "Deleting asset $assetId"
22-
# Invoke-RestMethod -Method Delete -Uri "https://api.github.com/repos/LikithaVemulapalli/aws-node-termination-handler/releases/assets/$assetId" -Headers @{Authorization = "token $env:GITHUB_TOKEN"}
23-
# }
24-
# exit $ExitCode
25-
# }
26-
# }
8+
$ErrorActionPreference = "Stop"
9+
10+
# Function to handle errors and cleanup any partially uploaded assets
11+
function HandleErrorsAndCleanup {
12+
param (
13+
[int]$ExitCode
14+
)
15+
if ($ExitCode -eq 0) {
16+
exit 0
17+
}
18+
if ($global:AssetIdsUploaded.Count -ne 0) {
19+
Write-Output "`nCleaning up assets uploaded in the current execution of the script"
20+
foreach ($assetId in $global:AssetIdsUploaded) {
21+
Write-Output "Deleting asset $assetId"
22+
Invoke-RestMethod -Method Delete -Uri "https://api.github.com/repos/LikithaVemulapalli/aws-node-termination-handler/releases/assets/$assetId" -Headers @{Authorization = "token $env:GITHUB_TOKEN"}
23+
}
24+
exit $ExitCode
25+
}
26+
}
2727

2828
# Function to upload an asset to GitHub
2929
function UploadAsset {
@@ -40,7 +40,7 @@ function UploadAsset {
4040
try {
4141
$Response = Invoke-RestMethod -Method Post -Uri $Uri -Headers $Headers -InFile $AssetPath -ErrorAction Stop
4242
if ($Response -and $Response.id) {
43-
#$global:AssetIdsUploaded += $Response.id
43+
$global:AssetIdsUploaded += $Response.id
4444
Write-Output "Created asset ID $($Response.id) successfully"
4545
} else {
4646
Write-Output "❌ Upload failed with response message: $($Response | ConvertTo-Json)"
@@ -53,14 +53,16 @@ function UploadAsset {
5353
}
5454

5555
# Initialize global variables
56-
# $global:AssetIdsUploaded = @()
57-
# trap { HandleErrorsAndCleanup -ExitCode $global:LASTEXITCODE }
56+
$global:AssetIdsUploaded = @()
57+
trap { HandleErrorsAndCleanup -ExitCode $global:LASTEXITCODE }
5858

5959
$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
60-
$Version = v1.109.0
60+
$Version = "v1.110.0"
6161
$BuildDir = "$ScriptPath/../build/k8s-resources/$Version"
6262
$BinaryDir = "$ScriptPath/../build/bin"
6363

64+
[Net.ServicePointManager]::SecurityProtocol = [Net.::SecurityProtocolType]::Tls12
65+
6466
try {
6567
$Response = (Invoke-RestMethod -Uri "https://api.github.com/repos/LikithaVemulapalli/aws-node-termination-handler/releases" -Headers @{Authorization = "token $env:GITHUB_TOKEN"})
6668
} catch {
@@ -72,12 +74,9 @@ Write-Output "API Response:"
7274
Write-Output $Response | ForEach-Object { Write-Output $_.tag_name }
7375

7476

75-
$release = $Response | Where-Object {
76-
Write-Output "Checking release: $($_.tag_name)"
77-
$_.tag_name -eq $Version
78-
}
77+
$release = $Response | Where-Object { $_.tag_name -eq $Version }
7978

80-
Write-Output "Filtered Release"
79+
Write-Output "Filtered Release - latest release"
8180
Write-Output $release
8281

8382
$ReleaseId = $release.id
@@ -92,10 +91,12 @@ if (-not $ReleaseId) {
9291

9392
# Gather assets to upload based on the -BinariesOnly flag
9493
$Assets = @()
94+
if ($BinariesOnly) {
95+
$Assets += Get-ChildItem -Path $BinaryDir | ForEach-Object { $_.FullName }
96+
}
9597
if (-not $BinariesOnly) {
9698
$Assets += "$BuildDir\individual-resources.tar", "$BuildDir\all-resources.yaml", "$BuildDir\individual-resources-queue-processor.tar", "$BuildDir\all-resources-queue-processor.yaml"
9799
}
98-
$Assets += Get-ChildItem -Path $BinaryDir | ForEach-Object { $_.FullName }
99100

100101
# Log gathered assets
101102
Write-Output "Assets to upload:"

0 commit comments

Comments
 (0)