From 14811e65d2f818d78a0b1848b383d179dd06b23c Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 8 Dec 2017 16:25:32 +0000 Subject: [PATCH] Try booting something Signed-off-by: Ian Campbell --- .circleci/config.yml | 74 +++++++++++++++++++++++++++++++++++++++++--- test.exp | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 5 deletions(-) create mode 100755 test.exp diff --git a/.circleci/config.yml b/.circleci/config.yml index d961b09..ffd8422 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: @@ -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: @@ -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 @@ -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, @@ -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 diff --git a/test.exp b/test.exp new file mode 100755 index 0000000..a782fb5 --- /dev/null +++ b/test.exp @@ -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 + } +}