From 41d4d9f459bfc322a7d7db83097b6a12ac31797e Mon Sep 17 00:00:00 2001 From: Daniel Fiala Date: Fri, 20 Sep 2024 07:28:59 +0200 Subject: [PATCH] Fixed build-test-windows.yml Signed-off-by: Daniel Fiala --- .github/workflows/build-test-windows.yml | 15 ++++++++------- 22/windowsservercore-ltsc2019/Dockerfile | 4 +--- 22/windowsservercore-ltsc2022/Dockerfile | 4 +--- Dockerfile-windows.template | 4 +--- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index 1a5bc0c0c..bd7daf0ee 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "22.8.0" ] + version: [ "22.9.0" ] variant: [ "windowsservercore-ltsc2019" ] steps: @@ -49,19 +49,19 @@ jobs: exit 1 } - - name: Verify entrypoint runs regular, non-executable files with node + - name: Verify node runs regular files shell: pwsh run: | $tempDir = New-Item -ItemType Directory -Path $env:TEMP -Name "tempNodeApp" $tmp_file = Join-Path $tempDir "index.js" "console.log('success')" | Out-File -FilePath $tmp_file -Encoding utf8 - $output = (docker run --rm -w /app --mount "type=bind,src=$tempDir,target=c:\app" node:${{ matrix.version }}-${{ matrix.variant }} C:/app/index.js) + $output = (docker run --rm -w /app --mount "type=bind,src=$tempDir,target=c:\app" node:${{ matrix.version }}-${{ matrix.variant }} node C:/app/index.js) if ($output -ne 'success') { - Write-Host "Invalid" + exit 1 } - name: Test for npm - run: docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} npm --version + run: docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} powershell.exe npm --version build-windows-2022: name: build-windows-2022 @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "22.8.0" ] + version: [ "22.9.0" ] variant: [ "windowsservercore-ltsc2022" ] steps: @@ -110,4 +110,5 @@ jobs: } - name: Test for npm - run: docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} npm --version + # We need to use powershell.exe to run npm because docker needs to attach to process and npm is a batch file/powershell script + run: docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} powershell.exe npm --version diff --git a/22/windowsservercore-ltsc2019/Dockerfile b/22/windowsservercore-ltsc2019/Dockerfile index 03aa9a01a..642a660de 100644 --- a/22/windowsservercore-ltsc2019/Dockerfile +++ b/22/windowsservercore-ltsc2019/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/windows/servercore:ltsc2019 as installer +FROM mcr.microsoft.com/windows/servercore:ltsc2019 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -18,5 +18,3 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Remove-Item node.zip -Force ; \ node --version; \ npm --version; - -CMD [ "node.exe" ] diff --git a/22/windowsservercore-ltsc2022/Dockerfile b/22/windowsservercore-ltsc2022/Dockerfile index eae112a63..c6c5365ec 100644 --- a/22/windowsservercore-ltsc2022/Dockerfile +++ b/22/windowsservercore-ltsc2022/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/windows/servercore:ltsc2022 as installer +FROM mcr.microsoft.com/windows/servercore:ltsc2022 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -18,5 +18,3 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Remove-Item node.zip -Force ; \ node --version; \ npm --version; - -CMD [ "node.exe" ] diff --git a/Dockerfile-windows.template b/Dockerfile-windows.template index 97b174e23..05da6f405 100644 --- a/Dockerfile-windows.template +++ b/Dockerfile-windows.template @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/windows/servercore:version as installer +FROM mcr.microsoft.com/windows/servercore:version SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -18,5 +18,3 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl Remove-Item node.zip -Force ; \ node --version; \ npm --version; - -CMD [ "node.exe" ]