1# Uploads debug files to Sentry with retry logic.
2#
3# Usage: Upload-ToSentry -Paths @("file1", "file2")
4#
5# Requires sentry-cli and SENTRY_AUTH_TOKEN to be available.
6# Throws if all attempts fail.
7function Upload-ToSentry {
8 param(
9 [Parameter(Mandatory=$true)]
10 [string[]]$Paths
11 )
12
13 for ($attempt = 1; $attempt -le 3; $attempt++) {
14 try {
15 Write-Output "Sentry upload attempt $attempt/3..."
16 sentry-cli debug-files upload --include-sources --wait -p zed -o zed-dev @Paths
17 Write-Output "Sentry upload successful on attempt $attempt"
18 return
19 }
20 catch {
21 Write-Output "Sentry upload failed on attempt ${attempt}: $_"
22 if ($attempt -eq 3) {
23 throw "All sentry upload attempts failed"
24 }
25 Start-Sleep -Seconds 5
26 }
27 }
28}