-
Notifications
You must be signed in to change notification settings - Fork 0
386 lines (371 loc) · 11.4 KB
/
ci.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
name: 'oci-image'
on:
push:
jobs:
docker-buildx:
runs-on: ubuntu-24.04
services:
registry:
image: registry:2
ports:
- 80:5000
strategy:
fail-fast: false
matrix:
include:
- name: auth-proxy
file: imags/git-auth-proxy/Dockerfile
context: imags/git-auth-proxy
tags: localhost/l7/auth-proxy:latest
- name: container-socket-proxy
context: imags/container-socket-proxy
file: imags/container-socket-proxy/Dockerfile
tags: localhost/l7/container-socket-proxy:latest
- name: dnsmasq
file: imags/dnsmasq/Containerfile
context: imags/dnsmasq
tags: localhost/l7/dnsmasq:latest
- name: gpg-vault
file: imags/gpg-vault-pk/Containerfile
context: .
tags: localhost/l7/gpg-vault:latest
- name: node
file: imags/node-runner/Containerfile
context: .
tags: |
localhost/l7/node:latest
localhost/l7/node:20-bookworm
- name: nvim
file: imags/nvim/Containerfile
context: .
tags: |
localhost/l7/nvim:latest
localhost/l7/dev-shell:latest
localhost/l7/dev-shell:nvim
build-args: |
BASE_IMAGE=localhost/l7/podman-remote:latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Allow cleartext http to localhost container registry (docker)
run: |
echo '{"insecure-registries" : [ "localhost" ]}' | sudo tee /etc/docker/daemon.json
- name: Allow cleartext http to localhost container registry (podman)
run: |
mkdir -p ~/.config/containers/registries.conf.d
echo "[[registry]]
location = 'localhost:80'
insecure = true" | tee ~/.config/containers/registries.conf.d/insecure-localhost.conf
systemctl --user restart podman
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- uses: actions/checkout@v4
with:
submodules: true
- name: Build and load caddy image
if: ${{ matrix.name == 'nvim' || matrix.name == 'node' }}
uses: docker/build-push-action@v6
with:
context: imags/caddy
file: imags/caddy/Containerfile
tags: localhost/l7/caddy:latest
load: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and load base image
if: ${{ matrix.name == 'nvim' || matrix.name == 'node' }}
uses: docker/build-push-action@v6
with:
context: .
file: imags/alpine/Containerfile
tags: localhost/l7/alpine:3.20
build-args: |
ALPINE_VERSION=3.20
load: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and load podman-remote image
if: ${{ matrix.name == 'nvim' || matrix.name == 'node' }}
uses: docker/build-push-action@v6
with:
context: .
file: imags/alpine/Containerfile
tags: localhost/l7/podman-remote:latest
build-args: |
BASE_IMAGE=localhost/l7/alpine:3.20
load: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and load ${{ matrix.name }} image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.file }}
build-args: ${{ matrix.build-args }}
tags: ${{ matrix.tags }}
load: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
test-make-all:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
cmd:
- podman
os:
- ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Allow cleartext http to localhost container registry (podman)
run: |
mkdir -p ~/.config/containers/registries.conf.d
echo "[[registry]]
location = 'localhost:80'
insecure = true" | tee ~/.config/containers/registries.conf.d/insecure-localhost.conf
systemctl --user restart podman
- name: Make images
run: |
make images_deps
- name: Make test images
run: |
make -j6 images_test
- name: Make GUI images
run: |
make images_gui
env:
CMD: ${{ matrix.cmd }}
CONTAINER_CMD: ${{ matrix.cmd }}
test-make:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
image:
- acng
- auth_proxy
- container_proxy
- caddy
- dnsmasq
- gpg_pk
- nvim
- runner_node
cmd:
#- docker
- podman
os:
#- ubuntu-20.04
#- ubuntu-22.04
- ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup podman
run: |
mkdir -p ~/.config/containers/registries.conf.d
echo "[[registry]]
location = 'localhost:80'
insecure = true" | tee ~/.config/containers/registries.conf.d/insecure-localhost.conf
systemctl --user restart podman.socket
podman info
- name: Prep
run: sudo apt-get install -y whois --no-install-recommends
- name: Make deps
if: ${{ matrix.image == 'nvim' || matrix.image == 'runner_node' }}
run: make CMD=${{ matrix.cmd }} image_caddy
- run: make -j4 CMD=${{ matrix.cmd }} image_${{ matrix.image }}
- run: make CMD=${{ matrix.cmd }} inspect_${{ matrix.image }}
- run: make -j4 CMD=${{ matrix.cmd }} test_${{ matrix.image }}
- name: Extra tests
if: ${{ matrix.image == 'nvim' && matrix.os == 'ubuntu-24.04' }}
run: |
make -j6 CMD=${{ matrix.cmd }} images
make -j4 CMD=${{ matrix.cmd }} test_extra_${{ matrix.image }}
env:
CMD: ${{ matrix.cmd }}
CONTAINER_CMD: ${{ matrix.cmd }}
L7_DISABLE_SELINUX: '1'
test-compose:
runs-on: ${{ matrix.os }}
services:
registry:
image: registry:2
ports:
- 80:5000
strategy:
fail-fast: false
matrix:
test:
- test_compose_run
- images_gui
os:
- ubuntu-24.04
steps:
- name: Setup podman
run: |
mkdir -p ~/.config/containers/registries.conf.d
echo "[[registry]]
location = 'localhost:80'
insecure = true" | tee ~/.config/containers/registries.conf.d/insecure-localhost.conf
systemctl --user restart podman.socket
podman info
- uses: actions/checkout@v4
with:
submodules: true
- name: Prep
run: |
sudo apt-get install -y whois --no-install-recommends
make -j4 image_alpine
- run: make -j4 ${{ matrix.test }}
env:
DEBUG: ''
L7_DISABLE_SELINUX: '1'
test-e2e-podman:
runs-on: ubuntu-${{ matrix.ubuntu-version }}
services:
registry:
image: registry:2
ports:
- 80:5000
permissions:
contents: read
strategy:
fail-fast: false
matrix:
test:
- curl
- ghauth
- node_corepack
- lsp_typescript
- node_majors
ubuntu-version:
- 24.04
steps:
- name: Setup podman
run: |
mkdir -p ~/.config/containers/registries.conf.d
echo "[[registry]]
location = 'localhost:80'
insecure = true" | tee ~/.config/containers/registries.conf.d/insecure-localhost.conf
systemctl --user restart podman.socket
podman info
- uses: actions/checkout@v4
with:
submodules: true
- name: set up user config
run: |
sudo chown -R $(id -u):$(id -g) "${HOME}"
sudo apt install -y whois
usertokenhash="$(mkpasswd -m sha512crypt 'e2e-test-token')"
echo 'GITHUB_TOKEN=e2e-test-token' > env
echo 'GH_TOKEN=e2e-test-token' >> env
echo "export L7_USER_TOKEN_HASH='${usertokenhash}'" > .env
echo 'export L7_GITHUB_TOKEN=${{ github.token }}' >> .env
- name: Build images
run: |
make images_deps
make -j6 image_dev_shell image_runner_node
make -j6 test_runner_node
if: ${{ matrix.test == 'node_corepack' }}
- name: Build images
run: |
make image_caddy
make -j6 image_dev_shell image_runner_node_all
if: ${{ matrix.test == 'node_majors' }}
- name: Build images
run: |
make images_deps
make -j6 images
make -j2 images_test
make -j2 test_lsp_node
if: ${{ matrix.test == 'lsp_typescript' }}
- run: |
make images_deps
make -j6 images
if: ${{ matrix.test == 'ghauth' }}
- run: |
make images_deps
make -j6 images
if: ${{ matrix.test == 'curl' }}
- name: Run test ${{ matrix.test }}
run: |
podman network ls
make test_e2e_${{ matrix.test }}
env:
DEBUG: ''
L7_DISABLE_SELINUX: '1'
# TODO: should work
# test-e2e-docker:
# runs-on: ubuntu-${{ matrix.ubuntu-version }}
# needs: test-make-all
# services:
# registry:
# image: registry:2
# ports:
# - 80:5000
# permissions:
# contents: read
# strategy:
# fail-fast: false
# matrix:
# test:
# - curl
# - ghauth
# ubuntu-version:
# - 22.04
# - 24.04
# steps:
# - name: Allow cleartext http to localhost container registry (docker)
# run: |
# echo '{"insecure-registries" : [ "localhost" ]}' | sudo tee /etc/docker/daemon.json
#
# - name: Restore image cache
# uses: actions/cache/restore@v4
# with:
# path: /tmp/ci-images
# key: 'ci-test-${{ github.sha }}'
#
# - name: Import cached images
# run: |
# set -x
# ls -la /tmp/ci-images
# find /tmp/ci-images -type f -name '*.tar' -exec sudo docker load -i '{}' \;
# sudo docker images
#
# - uses: actions/checkout@v4
# with:
# submodules: true
#
# - name: set up user config
# run: |
# sudo chown -R $(id -u):$(id -g) "${HOME}"
# sudo apt install -y whois
# usertokenhash="$(mkpasswd -m sha512crypt 'e2e-test-token')"
# echo 'GITHUB_TOKEN=e2e-test-token' > env
# echo "export L7_USER_TOKEN_HASH=${usertokenhash}" > .env
# echo 'export L7_GITHUB_TOKEN=${{ github.token }}' > .env
#
# - name: Prep docker
# run: |
# sudo apt-get update
# sudo apt-get dist-upgrade -y
# sudo apt-get install -y --no-install-recommends docker-compose
# sudo systemctl restart docker.service
# sudo -E docker --version
# - name: Run test ${{ matrix.test }}
# run: |
# sudo -E docker network ls
# make test_e2e_${{ matrix.test }}
# env:
# CMD: sudo -E docker
# CONTAINER_CMD: sudo -E docker
# DEBUG: '1'