Skip to content

Commit e89ce1f

Browse files
authored
Merge pull request jimmckeeth#7 from jimmckeeth/ci/fix-smoke-test-windows-container-limitation
Fix smoke test: Windows runners don't support native container jobs
2 parents 4710b83 + 0680b76 commit e89ce1f

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

‎.github/workflows/self-hosted-container-smoke-test.yml‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ on:
55

66
jobs:
77
compile-in-container:
8-
runs-on: [self-hosted, windows, delphi, container]
9-
container:
10-
image: delphi-builder:12-athens
11-
volumes:
12-
- 'C:\Program Files (x86)\Embarcadero:C:\Program Files (x86)\Embarcadero:ro'
13-
- 'C:\Users\Public\Documents\Embarcadero:C:\Users\Public\Documents\Embarcadero:ro'
8+
runs-on: [self-hosted, windows, delphi]
149
steps:
1510
- name: Write a trivial Delphi program
1611
shell: cmd
@@ -21,14 +16,22 @@ jobs:
2116
echo WriteLn('Hello from a process-isolated container'^); >> Hello.dpr
2217
echo end. >> Hello.dpr
2318
24-
- name: Compile with dcc64
25-
shell: cmd
26-
run: dcc64.exe Hello.dpr
27-
28-
- name: Run the compiled binary
29-
shell: cmd
30-
run: Hello.exe
19+
- name: Compile and run inside a process-isolated container
20+
shell: pwsh
21+
run: |
22+
docker run --rm --isolation process `
23+
-v "${{ github.workspace }}:C:\work" `
24+
-v "C:\Program Files (x86)\Embarcadero:C:\Program Files (x86)\Embarcadero:ro" `
25+
-v "C:\Users\Public\Documents\Embarcadero:C:\Users\Public\Documents\Embarcadero:ro" `
26+
-w C:\work `
27+
delphi-builder:12-athens `
28+
cmd /c "dcc64.exe Hello.dpr && Hello.exe && echo this container is ephemeral > C:\marker.txt && dir C:\marker.txt"
29+
if ($LASTEXITCODE -ne 0) { throw "container build failed with exit code $LASTEXITCODE" }
3130
32-
- name: Prove isolation - write a marker file that should not survive
33-
shell: cmd
34-
run: echo this container is ephemeral > C:\marker-%RANDOM%.txt && dir C:\marker-*.txt
31+
- name: Prove isolation - marker from the container must not exist on the runner host
32+
shell: pwsh
33+
run: |
34+
if (Test-Path "C:\marker.txt") {
35+
throw "ISOLATION FAILURE: C:\marker.txt leaked from the container onto the host"
36+
}
37+
Write-Output "Confirmed: container filesystem changes did not leak onto the host"

0 commit comments

Comments
 (0)