-
Notifications
You must be signed in to change notification settings - Fork 623
216 lines (207 loc) · 6.59 KB
/
test-images-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: prep
on:
push:
branches:
- main
- 'release/**'
pull_request:
paths-ignore:
- '**.md'
env:
GO_VERSION: 1.23.x
REGISTRY: ghcr.io
BUSYBOX_VERSION: 5ad83957fa74aafd061afbfb8da14ce3220659a9
REGISTRY_VERSION: v2.8.3
CURL_VERSION: 8.11.0_4
jobs:
build-busybox:
name: busybox
runs-on: ubuntu-24.04
steps:
- id: cache-busybox
uses: actions/cache@v4
with:
path: busybox.exe
enableCrossOsArchive: true
key: cache-busybox-${{ env.BUSYBOX_VERSION }}
- uses: actions/checkout@v4
if: steps.cache-busybox.outputs.cache-hit != 'true'
with:
repository: rmyorston/busybox-w32
ref: ${{ env.BUSYBOX_VERSION }}
fetch-depth: 1
path: ./src/busybox-w32
- name: ""
if: steps.cache-busybox.outputs.cache-hit != 'true'
run: |
sudo apt-get install gcc-mingw-w64 ncurses-dev
cd ./src/busybox-w32
make mingw64_defconfig
make
cd -
cp ./src/busybox-w32/busybox.exe .
build-curl:
name: busybox
runs-on: ubuntu-24.04
steps:
- id: cache-curl
uses: actions/cache@v4
with:
path: curl.exe
enableCrossOsArchive: true
key: cache-curl-${{ env.CURL_VERSION }}
- name: ""
if: steps.cache-curl.outputs.cache-hit != 'true'
run: |
curl -fsSLO https://curl.se/windows/dl-${CURL_VERSION}/curl-${CURL_VERSION}-win64-mingw.zip
unzip curl-${CURL_VERSION}-win64-mingw.zip
cp ./curl-${CURL_VERSION}-win64-mingw/bin/curl.exe .
build-registry:
name: registry
runs-on: ubuntu-24.04
steps:
- id: cache-registry
uses: actions/cache@v4
with:
path: build
enableCrossOsArchive: true
key: cache-registry-${{ env.REGISTRY_VERSION }}
- uses: actions/checkout@v4
if: steps.cache-registry.outputs.cache-hit != 'true'
with:
repository: distribution/distribution
ref: ${{ env.REGISTRY_VERSION }}
path: "${{ github.workspace }}/go/src/github.com/docker/distribution"
fetch-depth: 1
- uses: actions/setup-go@v5
if: steps.cache-registry.outputs.cache-hit != 'true'
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: "build"
if: steps.cache-registry.outputs.cache-hit != 'true'
run: |
export GOPATH="${{ github.workspace }}/go"
src="${{ github.workspace }}/go/src/github.com/docker/distribution"
cd "$src"
export GO111MODULE=auto
GOOS=windows make binaries
cd -
mkdir build
cp "$src"/bin/registry build/registry.exe
cp "$src"/cmd/registry/config-dev.yml build
image-busybox:
name: image-busybox
runs-on: windows-2022
needs:
- build-busybox
- build-curl
defaults:
run:
shell: bash
steps:
- uses: actions/cache/restore@v4
id: cache-busybox
with:
path: busybox.exe
enableCrossOsArchive: true
key: cache-busybox-${{ env.BUSYBOX_VERSION }}
fail-on-cache-miss: true
- uses: actions/cache/restore@v4
id: cache-curl
with:
path: curl.exe
enableCrossOsArchive: true
key: cache-curl-${{ env.CURL_VERSION }}
fail-on-cache-miss: true
- name: "Prep busybox image"
run: |
cat <<EOF > Dockerfile
# escape=\`
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
RUN mkdir C:\\tmp
RUN mkdir C:\\bin
COPY busybox.exe C:/bin/
COPY curl.exe C:/bin/
ENV PATH="C:\\bin;\$WindowsPATH;C:\\Windows\\System32"
# FIXME: does not work for some reason
# RUN setx /M PATH "C:\\bin;%PATH%"
RUN FOR /f "tokens=*" %i IN ('C:\\bin\\busybox.exe --list') DO mklink C:\\bin\\%i.exe C:\\bin\\busybox.exe
USER ContainerAdministrator
EOF
- name: "Build image"
run: |
docker build --tag dubogus/win-busybox -f Dockerfile .
echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin
docker push dubogus/win-busybox
image-registry:
name: image-registry
runs-on: windows-2022
needs: build-registry
defaults:
run:
shell: bash
steps:
- uses: actions/cache/restore@v4
id: cache-registry
with:
path: build
enableCrossOsArchive: true
key: cache-registry-${{ env.REGISTRY_VERSION }}
fail-on-cache-miss: true
- name: "Prep registry image"
run: |
cat <<EOF > Dockerfile
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
COPY ./build/registry.exe /registry.exe
COPY ./build/config-dev.yml /config.yml
EXPOSE 5000
ENTRYPOINT ["/registry"]
CMD ["serve", "/config.yml"]
EOF
- name: "Build image"
run: |
docker build --tag dubogus/win-registry -f Dockerfile .
echo ZGNrcl9wYXRfWXl6R3o1aDZLOUQwVU9lVnJpZ24yZ0Z5U2JVCg== | base64 -d | docker login -u dubogus --password-stdin
docker push dubogus/win-registry
sanity:
timeout-minutes: 30
name: windows
needs: build-busybox
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
check-latest: true
- run: go install ./cmd/nerdctl
- run: go install -v gotest.tools/gotestsum@v1
- uses: actions/checkout@v4.2.2
with:
repository: containerd/containerd
ref: v1.7.24
path: containerd
fetch-depth: 1
- name: "Set up CNI"
working-directory: containerd
run: GOPATH=$(go env GOPATH) script/setup/install-cni-windows
- name: "Set up containerd"
env:
ctrdVersion: 1.7.24
run: powershell hack/configure-windows-ci.ps1
- name: "Run integration tests"
run: |
nerdctl.exe run -q --rm --pull always dubogus/win-busybox ls -lA
nerdctl.exe run -q --rm --pull always dubogus/win-busybox echo "\$USERNAME"
nerdctl.exe run -q -d --pull always --name sleep dubogus/win-busybox sleep 3600
nerdctl.exe ps -a
nerdctl.exe top sleep
nerdctl.exe top sleep -o pid,user,cmd