Skip to content

Commit 371dd21

Browse files
committed
ci: support Windows Hyper-V isolation - DRAFT
Signed-off-by: Olli Janatuinen <[email protected]>
1 parent 6e21389 commit 371dd21

3 files changed

Lines changed: 25 additions & 124 deletions

File tree

.github/workflows/windows.yml

Lines changed: 22 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
os:
35-
- windows-2019
36-
- windows-2022
35+
# - windows-2019
36+
# - windows-2022
37+
- self-hosted
3738
env:
3839
GOPATH: ${{ github.workspace }}\go
3940
GOBIN: ${{ github.workspace }}\go\bin
@@ -61,6 +62,7 @@ jobs:
6162
} ElseIf ("${{ matrix.os }}" -eq "windows-2022") {
6263
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
6364
}
65+
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
6466
-
6567
name: Cache
6668
uses: actions/cache@v3
@@ -108,120 +110,6 @@ jobs:
108110
if-no-files-found: error
109111
retention-days: 2
110112

111-
unit-test:
112-
runs-on: ${{ matrix.os }}
113-
strategy:
114-
fail-fast: false
115-
matrix:
116-
os:
117-
- windows-2019
118-
- windows-2022
119-
env:
120-
GOPATH: ${{ github.workspace }}\go
121-
GOBIN: ${{ github.workspace }}\go\bin
122-
defaults:
123-
run:
124-
working-directory: ${{ env.GOPATH }}/src/github.com/docker/docker
125-
steps:
126-
-
127-
name: Checkout
128-
uses: actions/checkout@v3
129-
with:
130-
path: ${{ env.GOPATH }}/src/github.com/docker/docker
131-
-
132-
name: Env
133-
run: |
134-
Get-ChildItem Env: | Out-String
135-
-
136-
name: Init
137-
run: |
138-
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
139-
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod"
140-
New-Item -ItemType "directory" -Path "bundles"
141-
If ("${{ matrix.os }}" -eq "windows-2019") {
142-
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
143-
} ElseIf ("${{ matrix.os }}" -eq "windows-2022") {
144-
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
145-
}
146-
-
147-
name: Cache
148-
uses: actions/cache@v3
149-
with:
150-
path: |
151-
~\AppData\Local\go-build
152-
~\go\pkg\mod
153-
${{ github.workspace }}\go-build
154-
${{ env.GOPATH }}\pkg\mod
155-
key: ${{ matrix.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }}
156-
restore-keys: |
157-
${{ matrix.os }}-${{ github.job }}-
158-
-
159-
name: Docker info
160-
run: |
161-
docker info
162-
-
163-
name: Build base image
164-
run: |
165-
docker pull ${{ env.WINDOWS_BASE_IMAGE }}:${{ env.WINDOWS_BASE_IMAGE_TAG }}
166-
docker tag ${{ env.WINDOWS_BASE_IMAGE }}:${{ env.WINDOWS_BASE_IMAGE_TAG }} microsoft/windowsservercore
167-
docker build --build-arg GO_VERSION -t ${{ env.TEST_IMAGE_NAME }} -f Dockerfile.windows .
168-
-
169-
name: Test
170-
run: |
171-
& docker run --name ${{ env.TEST_CTN_NAME }} -e "DOCKER_GITCOMMIT=${{ github.sha }}" `
172-
-v "${{ github.workspace }}\go-build:C:\Users\ContainerAdministrator\AppData\Local\go-build" `
173-
-v "${{ github.workspace }}\go\pkg\mod:C:\gopath\pkg\mod" `
174-
-v "${{ env.GOPATH }}\src\github.com\docker\docker\bundles:C:\gopath\src\github.com\docker\docker\bundles" `
175-
${{ env.TEST_IMAGE_NAME }} hack\make.ps1 -TestUnit
176-
-
177-
name: Send to Codecov
178-
if: matrix.os == 'windows-2022'
179-
uses: codecov/codecov-action@v3
180-
with:
181-
working-directory: ${{ env.GOPATH }}\src\github.com\docker\docker
182-
directory: bundles
183-
env_vars: RUNNER_OS
184-
flags: unit
185-
-
186-
name: Upload reports
187-
if: always()
188-
uses: actions/upload-artifact@v3
189-
with:
190-
name: ${{ matrix.os }}-unit-reports
191-
path: ${{ env.GOPATH }}\src\github.com\docker\docker\bundles\*
192-
193-
unit-test-report:
194-
runs-on: ubuntu-latest
195-
if: always()
196-
needs:
197-
- unit-test
198-
strategy:
199-
fail-fast: false
200-
matrix:
201-
os:
202-
- windows-2019
203-
- windows-2022
204-
steps:
205-
-
206-
name: Set up Go
207-
uses: actions/setup-go@v3
208-
with:
209-
go-version: ${{ env.GO_VERSION }}
210-
-
211-
name: Download artifacts
212-
uses: actions/download-artifact@v3
213-
with:
214-
name: ${{ matrix.os }}-unit-reports
215-
path: /tmp/artifacts
216-
-
217-
name: Install teststat
218-
run: |
219-
go install github.com/vearutop/teststat@${{ env.TESTSTAT_VERSION }}
220-
-
221-
name: Create summary
222-
run: |
223-
teststat -markdown $(find /tmp/artifacts -type f -name '*.json' -print0 | xargs -0) >> $GITHUB_STEP_SUMMARY
224-
225113
integration-test-prepare:
226114
runs-on: ubuntu-latest
227115
outputs:
@@ -263,11 +151,15 @@ jobs:
263151
fail-fast: false
264152
matrix:
265153
os:
266-
- windows-2019
267-
- windows-2022
154+
# - windows-2019
155+
# - windows-2022
156+
- self-hosted
268157
runtime:
269158
- builtin
270-
- containerd
159+
# - containerd
160+
isolation:
161+
# - process
162+
- hyperv
271163
test: ${{ fromJson(needs.integration-test-prepare.outputs.matrix) }}
272164
env:
273165
GOPATH: ${{ github.workspace }}\go
@@ -301,6 +193,7 @@ jobs:
301193
} ElseIf ("${{ matrix.os }}" -eq "windows-2022") {
302194
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
303195
}
196+
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
304197
Write-Output "${{ env.BIN_OUT }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
305198
-
306199
# removes docker service that is currently installed on the runner. we
@@ -350,6 +243,9 @@ jobs:
350243
$runtimeArg="--containerd=\\.\pipe\containerd-containerd"
351244
echo "DOCKER_WINDOWS_CONTAINERD_RUNTIME=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
352245
}
246+
If ("${{ matrix.isolation }}" -eq "hyperv") {
247+
$runtimeArg="--exec-opt isolation=hyperv"
248+
}
353249
New-Item -ItemType Directory "$env:TEMP\moby-root" -ErrorAction SilentlyContinue | Out-Null
354250
New-Item -ItemType Directory "$env:TEMP\moby-exec" -ErrorAction SilentlyContinue | Out-Null
355251
Start-Process -Wait -NoNewWindow "${{ env.BIN_OUT }}\dockerd" `
@@ -492,11 +388,15 @@ jobs:
492388
fail-fast: false
493389
matrix:
494390
os:
495-
- windows-2019
496-
- windows-2022
391+
# - windows-2019
392+
# - windows-2022
393+
- self-hosted
497394
runtime:
498395
- builtin
499-
- containerd
396+
# - containerd
397+
isolation:
398+
# - process
399+
- hyperv
500400
steps:
501401
-
502402
name: Set up Go

contrib/busybox/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
# To build: docker build -t busybox .
1010
# To publish: Needs someone with publishing rights
1111
ARG WINDOWS_BASE_IMAGE=mcr.microsoft.com/windows/servercore
12-
ARG WINDOWS_BASE_IMAGE_TAG=ltsc2019
12+
ARG WINDOWS_BASE_IMAGE_TAG=ltsc2022
1313
ARG BUSYBOX_VERSION=FRP-3329-gcf0fa4d13
1414

1515
# Checksum taken from https://frippery.org/files/busybox/SHA256SUM
1616
ARG BUSYBOX_SHA256SUM=bfaeb88638e580fc522a68e69072e305308f9747563e51fa085eec60ca39a5ae
1717

1818
FROM ${WINDOWS_BASE_IMAGE}:${WINDOWS_BASE_IMAGE_TAG}
19-
RUN mkdir C:\tmp && mkdir C:\bin
19+
RUN mkdir C:\tmp && mkdir C:\bin && echo "works!!"
2020
ARG BUSYBOX_VERSION
2121
ARG BUSYBOX_SHA256SUM
2222
ADD https://frippery.org/files/busybox/busybox-w32-${BUSYBOX_VERSION}.exe /bin/busybox.exe
@@ -27,4 +27,5 @@ RUN powershell \
2727

2828
RUN setx /M PATH "C:\bin;%PATH%"
2929
RUN powershell busybox.exe --list ^|%{$nul = cmd /c mklink C:\bin\$_.exe busybox.exe}
30+
RUN ping -n 30 127.0.0.1
3031
CMD ["sh"]

0 commit comments

Comments
 (0)