Skip to content

Commit

Permalink
Try booting something
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Campbell <ijc@docker.com>
  • Loading branch information
Ian Campbell committed Dec 8, 2017
1 parent 9740eec commit 14811e6
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 5 deletions.
74 changes: 69 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ image_build: &image_build
- image: debian:stretch
# 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.
# NB: This will become a paid for feature at some point soon (with plenty of warning), so is not a long term solution.
# small 1.0 2GB
# medium (default) 2.0 4GB pass: fail:5
# medium+ 3.0 6GB pass: fail:2
# large 4.0 8GB pass:2 fail:
# xlarge 8.0 16GB
# small 1.0 2GB
# medium (default) 2.0 4GB pass: fail:5
# medium+ 3.0 6GB pass: fail:2
# large 4.0 8GB pass:2 fail:
# xlarge 8.0 16GB
resource_class: large
steps:
- run:
Expand Down Expand Up @@ -99,6 +99,26 @@ image_build: &image_build
root: /workspace
paths: images

image_boot: &image_boot
docker:
- image: debian:stretch
steps:
- run:
name: Configure $PATH
command: echo 'export PATH=/workspace/bin:$PATH' >> $BASH_ENV
- run:
name: Install packages
# ca-certificates are needed for attach_workspace (and git over https)
command: apt-get update && apt-get install -y ca-certificates curl git make openssh-client strace qemu
- attach_workspace:
at: /workspace
- checkout
- run:
name: Test boot
command: |
cp /workspace/images/kube-$KUBE_RUNTIME-$KUBE_NETWORK/kube-{master,node}.iso .
./test.exp
version: 2
jobs:
dependencies:
Expand Down Expand Up @@ -240,6 +260,30 @@ jobs:
- KUBE_RUNTIME: cri-containerd
- KUBE_NETWORK: bridge

boot-docker-weave:
<<: *image_boot
environment:
- KUBE_RUNTIME: docker
- KUBE_NETWORK: weave

#boot-docker-bridge:
# <<: *image_boot
# environment:
# - KUBE_RUNTIME: docker
# - KUBE_NETWORK: bridge

#boot-cri-containerd-weave:
# <<: *image_boot
# environment:
# - KUBE_RUNTIME: cri-containerd
# - KUBE_NETWORK: weave

boot-cri-containerd-bridge:
<<: *image_boot
environment:
- KUBE_RUNTIME: cri-containerd
- KUBE_NETWORK: bridge

push-pkgs-to-hub:
docker:
- image: debian:stretch
Expand Down Expand Up @@ -332,6 +376,22 @@ workflows:
- pkg-kubelet
- pkg-cri-containerd

- boot-docker-weave:
requires:
image-docker-weave

#- boot-docker-bridge:
# requires:
# image-docker-bridge

#- boot-cri-containerd-weave:
# requires:
# image-cri-containerd-weave

- boot-cri-containerd-bridge:
requires:
image-cri-containerd-bridge

- push-pkgs-to-hub:
# We want everything to have passed, which is a bit
# tedious. Some of these are already covered transitively,
Expand All @@ -346,3 +406,7 @@ workflows:
- image-docker-bridge
- image-cri-containerd-weave
- image-cri-containerd-bridge
- boot-docker-weave
#- boot-docker-bridge
#- boot-cri-containerd-weave
- boot-cri-containerd-bridge
62 changes: 62 additions & 0 deletions test.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env expect

# medium circle CI has 4G of RAM, use 3.5G for VM
spawn env {KUBE_RUN_ARGS=-publish 2222:22} KUBE_MEM=3584 KUBE_DISK=8G KUBE_CLEAR_STATE=y KUBE_MASTER_UNTAINT=y ./boot.sh
set lk_id $spawn_id
set lk_pid [exp_pid -i $lk_id]
set timeout 60

set console_prompt "(ns: getty) linuxkit-*:*# "
set ssh_prompt "linuxkit-*:*# "

expect {
$console_prompt {
puts "SUCCESS boot"
} timeout {
puts "FAIL boot (timeout)"
exec kill -9 $lk_pid
exit 1
}
}

# Getty service may start before sshd one is up and running, ConnectionAttempts=10 below doesn't seem affective, so give it a chance here.
sleep 3

spawn env {SSHOPTS=-p 2222 -o ConnectionAttempts=10 -o LogLevel=DEBUG} ./ssh_into_kubelet.sh localhost
set ssh_id $spawn_id
set ssh_pid [exp_pid -i $ssh_id]
set timeout 20

expect {
$ssh_prompt {
puts "RUN kubeadm-init.sh"
send "kubeadm-init.sh\n"
} timeout {
puts "FAIL ssh (timeout)"
exec kill -9 $lk_pid $ssh_pid
exit 1
}
}

expect {
$ssh_prompt {
puts "RUN poweroff -f"
send "poweroff -f\n"
} -timeout 120 timeout {
puts "FAIL kubeadm-init.sh (timeout)"
exec kill -9 $lk_pid $ssh_pid
exit 1
}
}

expect {
"Power down" {
puts "SUCCESS poweroff"
} eof {
puts "SUCCESS poweroff"
} timeout {
puts "FAILED poweroff (timeout)"
exec kill -9 $lk_pid $ssh_pid
exit 1
}
}

0 comments on commit 14811e6

Please sign in to comment.