From 005e0b0394e8756bf79050b301733061a949f8a5 Mon Sep 17 00:00:00 2001 From: rameen Date: Sat, 5 Sep 2026 19:48:46 +0330 Subject: [PATCH] fix: parse ci-resolve-node-image.ps1 on Windows PowerShell 5.1 --- infrastructure/scripts/ci-resolve-node-image.ps1 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/infrastructure/scripts/ci-resolve-node-image.ps1 b/infrastructure/scripts/ci-resolve-node-image.ps1 index 80d9aa3..e62d5de 100644 --- a/infrastructure/scripts/ci-resolve-node-image.ps1 +++ b/infrastructure/scripts/ci-resolve-node-image.ps1 @@ -1,5 +1,6 @@ # Prefer a Gitea-hosted node:20-alpine so docker build does not HEAD registry-1.docker.io. -# Order: local Gitea tag → pull Gitea → local Docker Hub tag → pull Hub (retries) → tag/push Gitea. +# Order: local Gitea tag -> pull Gitea -> local Docker Hub tag -> pull Hub (retries) -> tag/push Gitea. +# ASCII only: Windows PowerShell 5.1 + act_runner mis-parses backtick escapes in this file. param( [Parameter(Mandatory = $true)][string]$RegistryPrefix, [string]$OutFile = '.ci-node-image', @@ -8,6 +9,7 @@ param( $ErrorActionPreference = 'Continue' $mirror = "$RegistryPrefix/node:20-alpine" +$nl = [char]10 function Test-Image([string]$Name) { docker image inspect $Name 2>&1 | Out-Null @@ -26,7 +28,8 @@ function Invoke-Pull([string]$Name, [int]$Attempts) { function Save-Choice([string]$Name) { $utf8 = New-Object System.Text.UTF8Encoding $false - [System.IO.File]::WriteAllText((Join-Path (Get-Location) $OutFile), $Name + "`n", $utf8) + $path = Join-Path (Get-Location) $OutFile + [System.IO.File]::WriteAllText($path, ($Name + $nl), $utf8) Write-Host "NODE_IMAGE=$Name" } @@ -59,9 +62,9 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } docker push $mirror if ($LASTEXITCODE -ne 0) { - Write-Host "Could not push $mirror — docker build will use the local tag (legacy builder)." - $utf8 = New-Object System.Text.UTF8Encoding $false - [System.IO.File]::WriteAllText((Join-Path (Get-Location) '.ci-use-legacy-builder'), "1`n", $utf8) + Write-Host "Could not push $mirror - docker build will use the local tag (legacy builder)." + $flag = Join-Path (Get-Location) '.ci-use-legacy-builder' + New-Item -ItemType File -Path $flag -Force | Out-Null } Save-Choice $mirror