diff --git a/scripts/github_runner/clean_cri_runner.sh b/scripts/github_runner/clean_cri_runner.sh index 58e6e5ba4..1aebe0aee 100755 --- a/scripts/github_runner/clean_cri_runner.sh +++ b/scripts/github_runner/clean_cri_runner.sh @@ -41,6 +41,14 @@ sudo rm /etc/firecracker-containerd/fccd-cri.sock rm ${HOME}/.kube/config sudo rm -rf ${HOME}/tmp +echo Cleaning /var/lib/firecracker-containerd/* +for d in containerd shim-base snapshotter; do sudo rm -rf /var/lib/firecracker-containerd/$d; done + +echo Cleaning /run/firecracker-containerd/* +sudo rm -rf /run/firecracker-containerd/containerd.sock.ttrpc \ + /run/firecracker-containerd/io.containerd.runtime.v1.linux \ + /run/firecracker-containerd/io.containerd.runtime.v2.task + ifconfig -a | grep _tap | cut -f1 -d":" | while read line ; do sudo ip link delete "$line" ; done ifconfig -a | grep tap_ | cut -f1 -d":" | while read line ; do sudo ip link delete "$line" ; done -bridge -j vlan |jq -r '.[].ifname'| while read line ; do sudo ip link delete "$line" ; done \ No newline at end of file +bridge -j vlan |jq -r '.[].ifname'| while read line ; do sudo ip link delete "$line" ; done diff --git a/scripts/github_runner/start_runners.sh b/scripts/github_runner/start_runners.sh index ed51b1129..44f59e40a 100755 --- a/scripts/github_runner/start_runners.sh +++ b/scripts/github_runner/start_runners.sh @@ -24,7 +24,7 @@ if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ]; then echo "Parameters missing" - echo "USAGE: start_runners.sh https://github.com// " + echo "USAGE: start_runners.sh https://github.com// [restart]" exit -1 fi @@ -48,10 +48,18 @@ RUNNER_TOKEN="$(curl -XPOST -fsSL \ docker pull vhiveease/integ_test_runner docker pull vhiveease/cri_test_runner + + for number in $(seq 1 $1) do case "$4" in "integ") + + if [ "$5" == "restart" ]; then + docker container stop $(docker ps --format "{{.Names}}" | grep integration_test-github_runner) + docker container rm $(docker ps -a --format "{{.Names}}" | grep integration_test-github_runner) + fi + # create access token as mentioned here (https://github.com/myoung34/docker-github-actions-runner#create-github-personal-access-token) CONTAINERID=$(docker run -d --restart always --privileged \ --name "integration_test-github_runner-${number}" \ @@ -65,6 +73,11 @@ do vhiveease/integ_test_runner) ;; "cri") + + if [ "$5" == "restart" ]; then + kind get clusters | while read line ; do kind delete cluster --name "$line" ; done + fi + kind create cluster --image vhiveease/cri_test_runner --name "cri-test-github-runner-${number}" sleep 2m docker exec -it \ @@ -74,7 +87,7 @@ do ./config.sh \ --url "${_SHORT_URL}" \ --token "${RUNNER_TOKEN}" \ - --name "cri-test-github-runner-${number}-control-plane" \ + --name "cri-test-github-runner-${HOSTNAME}-${number}" \ --work "/root/_work" \ --labels "cri" \ --unattended \