Skip to content

Commit be77a63

Browse files
nohwndCopilot
andcommitted
repro2829: run harnesses in ltsc2019 container (PS 5.1.17763, AppVeyor build)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bef1e8b commit be77a63

1 file changed

Lines changed: 56 additions & 95 deletions

File tree

.github/workflows/repro-2829.yml

Lines changed: 56 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -6,172 +6,133 @@ on:
66
- nohwnd-fix-mock-ps51-regression-2829
77
workflow_dispatch:
88

9-
jobs:
10-
probe2019:
11-
runs-on: windows-2022
12-
name: probe ltsc2019 container
13-
steps:
14-
- name: Host + docker info
15-
shell: pwsh
16-
run: |
17-
Write-Host "HOST_PS=$($PSVersionTable.PSVersion.ToString())"
18-
Write-Host "HOST_OS=$([Environment]::OSVersion.Version.ToString())"
19-
docker version
20-
docker info --format '{{json .Isolation}}'
21-
22-
- name: Pull servercore ltsc2019
23-
shell: pwsh
24-
run: |
25-
$sw = [Diagnostics.Stopwatch]::StartNew()
26-
docker pull mcr.microsoft.com/windows/servercore:ltsc2019
27-
Write-Host "PULL_ELAPSED=$($sw.Elapsed)"
28-
29-
- name: Run container (hyperv isolation)
30-
shell: pwsh
31-
continue-on-error: true
32-
run: |
33-
docker run --rm --isolation=hyperv mcr.microsoft.com/windows/servercore:ltsc2019 powershell -NoProfile -Command "Write-Host ('PROBE_HYPERV_PS=' + `$PSVersionTable.PSVersion.ToString())"
9+
# Reproduce #2829 on the AppVeyor build family: Windows Server 2019 / PowerShell
10+
# 5.1.17763. GitHub retired the windows-2019 hosted runner, so we run a Server 2019
11+
# servercore container (PS 5.1.17763) under Hyper-V isolation on a windows-2022 runner.
3412

35-
- name: Run container (process isolation)
36-
shell: pwsh
37-
continue-on-error: true
38-
run: |
39-
docker run --rm --isolation=process mcr.microsoft.com/windows/servercore:ltsc2019 powershell -NoProfile -Command "Write-Host ('PROBE_PROCESS_PS=' + `$PSVersionTable.PSVersion.ToString())"
13+
env:
14+
IMG: mcr.microsoft.com/windows/servercore:ltsc2019
15+
DBLIB: '2025.12.28'
4016

41-
synthetic:
42-
if: ${{ false }}
17+
jobs:
18+
syn2019:
4319
runs-on: windows-2022
4420
strategy:
4521
fail-fast: false
4622
matrix:
4723
pester: ['5.7.1', '6.0.0-rc1', '6.0.0-rc2', '6.0.0-rc3', '6.0.0-rc4']
48-
name: synthetic ${{ matrix.pester }}
24+
name: syn2019 ${{ matrix.pester }}
4925
steps:
5026
- uses: actions/checkout@v4
5127

52-
- name: Save Pester ${{ matrix.pester }}
28+
- name: Save Pester ${{ matrix.pester }} (host)
5329
shell: pwsh
5430
run: |
31+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
32+
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
5533
$ver = '${{ matrix.pester }}'
5634
$folder = ($ver -split '-')[0]
57-
$dest = Join-Path $env:RUNNER_TEMP "pmods_$ver"
35+
$dest = Join-Path $env:RUNNER_TEMP 'pmods'
5836
New-Item -ItemType Directory -Path $dest -Force | Out-Null
59-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
60-
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
6137
$pre = $ver -like '*-*'
6238
Save-Module -Name Pester -RequiredVersion $ver -AllowPrerelease:$pre -Path $dest -Repository PSGallery -Force
63-
$psd1 = Join-Path $dest "Pester\$folder\Pester.psd1"
64-
if (-not (Test-Path $psd1)) { throw "psd1 not found at $psd1" }
65-
"PESTER_PSD1=$psd1" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
39+
"PFOLDER=$folder" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
6640
67-
- name: Variants on Windows PowerShell 5.1 (Desktop)
68-
shell: powershell
69-
continue-on-error: true
70-
run: |
71-
powershell -NoProfile -ExecutionPolicy Bypass -File .repro2829\variants.ps1 -PesterPsd1 "$env:PESTER_PSD1"
41+
- name: Pull ltsc2019
42+
shell: pwsh
43+
run: docker pull $env:IMG
7244

73-
- name: Variants on PowerShell 7 (Core)
45+
- name: Variants in ltsc2019 (PS 5.1.17763)
7446
shell: pwsh
7547
continue-on-error: true
7648
run: |
77-
pwsh -NoProfile -File .repro2829/variants.ps1 -PesterPsd1 "$env:PESTER_PSD1"
49+
$ws = $env:GITHUB_WORKSPACE
50+
$tmp = $env:RUNNER_TEMP
51+
$psd1 = "C:\pmods\Pester\$env:PFOLDER\Pester.psd1"
52+
docker run --rm --isolation=hyperv -v "${ws}:C:\repo" -v "${tmp}\pmods:C:\pmods" $env:IMG powershell -NoProfile -ExecutionPolicy Bypass -File C:\repo\.repro2829\variants.ps1 -PesterPsd1 "$psd1"
7853
79-
real:
80-
if: ${{ false }}
54+
cum2019:
8155
runs-on: windows-2022
8256
strategy:
8357
fail-fast: false
8458
matrix:
8559
pester: ['5.7.1', '6.0.0-rc4']
86-
name: real dbatools ${{ matrix.pester }}
60+
name: cum2019 ${{ matrix.pester }}
8761
steps:
8862
- uses: actions/checkout@v4
8963

90-
- name: Save Pester ${{ matrix.pester }} and dbatools.library
64+
- name: Save Pester ${{ matrix.pester }} + dbatools.library (host)
9165
shell: pwsh
9266
run: |
9367
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
9468
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
95-
9669
$ver = '${{ matrix.pester }}'
9770
$folder = ($ver -split '-')[0]
98-
$dest = Join-Path $env:RUNNER_TEMP "pmods_$ver"
71+
$dest = Join-Path $env:RUNNER_TEMP 'pmods'
9972
New-Item -ItemType Directory -Path $dest -Force | Out-Null
10073
$pre = $ver -like '*-*'
10174
Save-Module -Name Pester -RequiredVersion $ver -AllowPrerelease:$pre -Path $dest -Repository PSGallery -Force
102-
$psd1 = Join-Path $dest "Pester\$folder\Pester.psd1"
103-
if (-not (Test-Path $psd1)) { throw "psd1 not found at $psd1" }
104-
"PESTER_PSD1=$psd1" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
105-
106-
$libdest = Join-Path $env:RUNNER_TEMP "libmods"
75+
"PFOLDER=$folder" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
76+
$libdest = Join-Path $env:RUNNER_TEMP 'libmods'
10777
New-Item -ItemType Directory -Path $libdest -Force | Out-Null
108-
Save-Module -Name dbatools.library -RequiredVersion 2025.12.28 -Path $libdest -Repository PSGallery -Force
109-
"LIBMODS=$libdest" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
78+
Save-Module -Name dbatools.library -RequiredVersion $env:DBLIB -Path $libdest -Repository PSGallery -Force
11079
111-
- name: Clone dbatools (PR 10405 head, commit 15c3981)
80+
- name: Clone dbatools (PR 10405 head)
11281
shell: pwsh
113-
run: |
114-
git clone --branch pester-6-rc --depth 1 https://github.com/nohwnd/dbatools.git "$env:RUNNER_TEMP\dbatools_src"
115-
"DBATOOLS_SRC=$env:RUNNER_TEMP\dbatools_src" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
82+
run: git clone --branch pester-6-rc --depth 1 https://github.com/nohwnd/dbatools.git "$env:RUNNER_TEMP\dbatools_src"
11683

117-
- name: Real negative test on Windows PowerShell 5.1 (Desktop)
118-
shell: powershell
119-
continue-on-error: true
120-
run: |
121-
powershell -NoProfile -ExecutionPolicy Bypass -File .repro2829\real-run.ps1 -PesterPsd1 "$env:PESTER_PSD1" -DbatoolsPath "$env:DBATOOLS_SRC" -LibraryModulePath "$env:LIBMODS"
84+
- name: Pull ltsc2019
85+
shell: pwsh
86+
run: docker pull $env:IMG
12287

123-
- name: Real negative test on PowerShell 7 (Core)
88+
- name: Cumulative replay in ltsc2019 (PS 5.1.17763)
12489
shell: pwsh
12590
continue-on-error: true
12691
run: |
127-
pwsh -NoProfile -File .repro2829/real-run.ps1 -PesterPsd1 "$env:PESTER_PSD1" -DbatoolsPath "$env:DBATOOLS_SRC" -LibraryModulePath "$env:LIBMODS"
92+
$ws = $env:GITHUB_WORKSPACE
93+
$tmp = $env:RUNNER_TEMP
94+
$psd1 = "C:\pmods\Pester\$env:PFOLDER\Pester.psd1"
95+
docker run --rm --isolation=hyperv -v "${ws}:C:\repo" -v "${tmp}\pmods:C:\pmods" -v "${tmp}\libmods:C:\libmods" -v "${tmp}\dbatools_src:C:\dbatools" $env:IMG powershell -NoProfile -ExecutionPolicy Bypass -File C:\repo\.repro2829\appveyor-repro.ps1 -PesterPsd1 "$psd1" -DbatoolsPath C:\dbatools -LibraryModulePath C:\libmods
12896
129-
cumulative:
130-
if: ${{ false }}
97+
real2019:
13198
runs-on: windows-2022
13299
strategy:
133100
fail-fast: false
134101
matrix:
135102
pester: ['5.7.1', '6.0.0-rc4']
136-
name: cumulative ${{ matrix.pester }}
103+
name: real2019 ${{ matrix.pester }}
137104
steps:
138105
- uses: actions/checkout@v4
139106

140-
- name: Save Pester ${{ matrix.pester }} and dbatools.library
107+
- name: Save Pester ${{ matrix.pester }} + dbatools.library (host)
141108
shell: pwsh
142109
run: |
143110
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
144111
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
145-
146112
$ver = '${{ matrix.pester }}'
147113
$folder = ($ver -split '-')[0]
148-
$dest = Join-Path $env:RUNNER_TEMP "pmods_$ver"
114+
$dest = Join-Path $env:RUNNER_TEMP 'pmods'
149115
New-Item -ItemType Directory -Path $dest -Force | Out-Null
150116
$pre = $ver -like '*-*'
151117
Save-Module -Name Pester -RequiredVersion $ver -AllowPrerelease:$pre -Path $dest -Repository PSGallery -Force
152-
$psd1 = Join-Path $dest "Pester\$folder\Pester.psd1"
153-
if (-not (Test-Path $psd1)) { throw "psd1 not found at $psd1" }
154-
"PESTER_PSD1=$psd1" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
155-
156-
$libdest = Join-Path $env:RUNNER_TEMP "libmods"
118+
"PFOLDER=$folder" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
119+
$libdest = Join-Path $env:RUNNER_TEMP 'libmods'
157120
New-Item -ItemType Directory -Path $libdest -Force | Out-Null
158-
Save-Module -Name dbatools.library -RequiredVersion 2025.12.28 -Path $libdest -Repository PSGallery -Force
159-
"LIBMODS=$libdest" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
121+
Save-Module -Name dbatools.library -RequiredVersion $env:DBLIB -Path $libdest -Repository PSGallery -Force
160122
161-
- name: Clone dbatools (PR 10405 head, commit 15c3981)
123+
- name: Clone dbatools (PR 10405 head)
162124
shell: pwsh
163-
run: |
164-
git clone --branch pester-6-rc --depth 1 https://github.com/nohwnd/dbatools.git "$env:RUNNER_TEMP\dbatools_src"
165-
"DBATOOLS_SRC=$env:RUNNER_TEMP\dbatools_src" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
125+
run: git clone --branch pester-6-rc --depth 1 https://github.com/nohwnd/dbatools.git "$env:RUNNER_TEMP\dbatools_src"
166126

167-
- name: Cumulative replay on Windows PowerShell 5.1 (Desktop)
168-
shell: powershell
169-
continue-on-error: true
170-
run: |
171-
powershell -NoProfile -ExecutionPolicy Bypass -File .repro2829\appveyor-repro.ps1 -PesterPsd1 "$env:PESTER_PSD1" -DbatoolsPath "$env:DBATOOLS_SRC" -LibraryModulePath "$env:LIBMODS"
127+
- name: Pull ltsc2019
128+
shell: pwsh
129+
run: docker pull $env:IMG
172130

173-
- name: Cumulative replay on PowerShell 7 (Core)
131+
- name: Real negative test in ltsc2019 (PS 5.1.17763)
174132
shell: pwsh
175133
continue-on-error: true
176134
run: |
177-
pwsh -NoProfile -File .repro2829/appveyor-repro.ps1 -PesterPsd1 "$env:PESTER_PSD1" -DbatoolsPath "$env:DBATOOLS_SRC" -LibraryModulePath "$env:LIBMODS"
135+
$ws = $env:GITHUB_WORKSPACE
136+
$tmp = $env:RUNNER_TEMP
137+
$psd1 = "C:\pmods\Pester\$env:PFOLDER\Pester.psd1"
138+
docker run --rm --isolation=hyperv -v "${ws}:C:\repo" -v "${tmp}\pmods:C:\pmods" -v "${tmp}\libmods:C:\libmods" -v "${tmp}\dbatools_src:C:\dbatools" $env:IMG powershell -NoProfile -ExecutionPolicy Bypass -File C:\repo\.repro2829\real-run.ps1 -PesterPsd1 "$psd1" -DbatoolsPath C:\dbatools -LibraryModulePath C:\libmods

0 commit comments

Comments
 (0)