Skip to content

Commit a22eacb

Browse files
author
Ian Campbell
committed
Try booting something
Signed-off-by: Ian Campbell <[email protected]>
1 parent 64a1f43 commit a22eacb

File tree

2 files changed

+131
-5
lines changed

2 files changed

+131
-5
lines changed

.circleci/config.yml

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ image_build: &image_build
3737
- image: debian:stretch
3838
# image builds seem to need a bit more grunt (RAM) than usual. Possibly getting OOM killed, which https://github.com/moby/tool/pull/191 might help.
3939
# NB: This will become a paid for feature at some point soon (with plenty of warning), so is not a long term solution.
40-
# small 1.0 2GB
41-
# medium (default) 2.0 4GB pass: fail:5
42-
# medium+ 3.0 6GB pass: fail:2
43-
# large 4.0 8GB pass:2 fail:
44-
# xlarge 8.0 16GB
40+
# small 1.0 2GB
41+
# medium (default) 2.0 4GB pass: fail:5
42+
# medium+ 3.0 6GB pass: fail:2
43+
# large 4.0 8GB pass:2 fail:
44+
# xlarge 8.0 16GB
4545
resource_class: large
4646
steps:
4747
- run:
@@ -99,6 +99,26 @@ image_build: &image_build
9999
root: /workspace
100100
paths: images
101101

102+
image_boot: &image_boot
103+
docker:
104+
- image: debian:stretch
105+
steps:
106+
- run:
107+
name: Configure $PATH
108+
command: echo 'export PATH=/workspace/bin:$PATH' >> $BASH_ENV
109+
- run:
110+
name: Install packages
111+
# ca-certificates are needed for attach_workspace (and git over https)
112+
command: apt-get update && apt-get install -y ca-certificates curl git make openssh-client strace qemu
113+
- attach_workspace:
114+
at: /workspace
115+
- checkout
116+
- run:
117+
name: Test boot
118+
command: |
119+
cp /workspace/images/kube-$KUBE_RUNTIME-$KUBE_NETWORK/kube-{master,node}.iso .
120+
./test.exp
121+
102122
version: 2
103123
jobs:
104124
dependencies:
@@ -240,6 +260,30 @@ jobs:
240260
- KUBE_RUNTIME: cri-containerd
241261
- KUBE_NETWORK: bridge
242262

263+
boot-docker-weave:
264+
<<: *image_boot
265+
environment:
266+
- KUBE_RUNTIME: docker
267+
- KUBE_NETWORK: weave
268+
269+
#boot-docker-bridge:
270+
# <<: *image_boot
271+
# environment:
272+
# - KUBE_RUNTIME: docker
273+
# - KUBE_NETWORK: bridge
274+
275+
#boot-cri-containerd-weave:
276+
# <<: *image_boot
277+
# environment:
278+
# - KUBE_RUNTIME: cri-containerd
279+
# - KUBE_NETWORK: weave
280+
281+
boot-cri-containerd-bridge:
282+
<<: *image_boot
283+
environment:
284+
- KUBE_RUNTIME: cri-containerd
285+
- KUBE_NETWORK: bridge
286+
243287
push-pkgs-to-hub:
244288
docker:
245289
- image: debian:stretch
@@ -332,6 +376,22 @@ workflows:
332376
- pkg-kubelet
333377
- pkg-cri-containerd
334378

379+
- boot-docker-weave:
380+
requires:
381+
image-docker-weave
382+
383+
#- boot-docker-bridge:
384+
# requires:
385+
# image-docker-bridge
386+
387+
#- boot-cri-containerd-weave:
388+
# requires:
389+
# image-cri-containerd-weave
390+
391+
- boot-cri-containerd-bridge:
392+
requires:
393+
image-cri-containerd-bridge
394+
335395
- push-pkgs-to-hub:
336396
# We want everything to have passed, which is a bit
337397
# tedious. Some of these are already covered transitively,
@@ -346,3 +406,7 @@ workflows:
346406
- image-docker-bridge
347407
- image-cri-containerd-weave
348408
- image-cri-containerd-bridge
409+
- boot-docker-weave
410+
#- boot-docker-bridge
411+
#- boot-cri-containerd-weave
412+
- boot-cri-containerd-bridge

test.exp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env expect
2+
3+
# medium circle CI has 4G of RAM, use 3.5G for VM
4+
spawn env {KUBE_RUN_ARGS=-publish 2222:22} KUBE_MEM=3584 KUBE_DISK=8G KUBE_CLEAR_STATE=y KUBE_MASTER_UNTAINT=y ./boot.sh
5+
set lk_id $spawn_id
6+
set lk_pid [exp_pid -i $lk_id]
7+
set timeout 60
8+
9+
set console_prompt "(ns: getty) linuxkit-*:*# "
10+
set ssh_prompt "linuxkit-*:*# "
11+
12+
expect {
13+
$console_prompt {
14+
puts "SUCCESS boot"
15+
} timeout {
16+
puts "FAIL boot (timeout)"
17+
exec kill -9 $lk_pid
18+
exit 1
19+
}
20+
}
21+
22+
# Getty service may start before sshd one is up and running, ConnectionAttempts=10 below doesn't seem affective, so give it a chance here.
23+
sleep 3
24+
25+
spawn env {SSHOPTS=-p 2222 -o ConnectionAttempts=10 -o LogLevel=DEBUG} ./ssh_into_kubelet.sh localhost
26+
set ssh_id $spawn_id
27+
set ssh_pid [exp_pid -i $ssh_id]
28+
set timeout 20
29+
30+
expect {
31+
$ssh_prompt {
32+
puts "RUN kubeadm-init.sh"
33+
send "kubeadm-init.sh\n"
34+
} timeout {
35+
puts "FAIL ssh (timeout)"
36+
exec kill -9 $lk_pid $ssh_pid
37+
exit 1
38+
}
39+
}
40+
41+
expect {
42+
$ssh_prompt {
43+
puts "RUN poweroff -f"
44+
send "poweroff -f\n"
45+
} -timeout 120 timeout {
46+
puts "FAIL kubeadm-init.sh (timeout)"
47+
exec kill -9 $lk_pid $ssh_pid
48+
exit 1
49+
}
50+
}
51+
52+
expect {
53+
"Power down" {
54+
puts "SUCCESS poweroff"
55+
} eof {
56+
puts "SUCCESS poweroff"
57+
} timeout {
58+
puts "FAILED poweroff (timeout)"
59+
exec kill -9 $lk_pid $ssh_pid
60+
exit 1
61+
}
62+
}

0 commit comments

Comments
 (0)