Skip to content

Commit

Permalink
Merge pull request #4893 from medyagh/ci_clean_up_hyperkit
Browse files Browse the repository at this point in the history
CI: clean up stale hyperkit and none process and stale inaccessible vbox
  • Loading branch information
medyagh authored Jul 29, 2019
2 parents 3240558 + 64cced0 commit ff14075
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions hack/jenkins/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ if type -P virsh; then
| awk '{ print $2 }' \
| xargs -I {} sh -c "virsh -c qemu:///system destroy {}; virsh -c qemu:///system undefine {}" \
|| true
# list again after clean up
virsh -c qemu:///system list --all
fi

if type -P vboxmanage; then
Expand All @@ -139,6 +141,15 @@ if type -P vboxmanage; then
| cut -d'"' -f2 \
| xargs -I {} sh -c "vboxmanage startvm {} --type emergencystop; vboxmanage unregistervm {} --delete" \
|| true

# remove inaccessible stale VMs https://github.com/kubernetes/minikube/issues/4872
vboxmanage list vms \
| grep inaccessible \
| cut -d'"' -f3 \
| xargs -I {} sh -c "vboxmanage startvm {} --type emergencystop; vboxmanage unregistervm {} --delete" \
|| true
# list them again after clean up
vboxmanage list vms || true
fi

if type -P hdiutil; then
Expand All @@ -150,6 +161,23 @@ if type -P hdiutil; then
|| true
fi

# cleaning up stale hyperkits
if type -P hyperkit; then
# find all hyperkits excluding com.docker
hyper_procs=$(ps aux | grep hyperkit | grep -v com.docker | grep -v grep | grep -v osx_integration_tests_hyperkit.sh | awk '{print $2}' || true)
if [[ "${hyper_procs}" != "" ]]; then
echo "Found stale hyperkits test processes to kill : "
for p in $hyper_procs
do
echo "Killing stale hyperkit $p"
ps -f -p $p || true
kill $p || true
kill -9 $p || true
done
fi
fi


if [[ "${VM_DRIVER}" == "hyperkit" ]]; then
if [[ -e out/docker-machine-driver-hyperkit ]]; then
sudo chown root:wheel out/docker-machine-driver-hyperkit || true
Expand All @@ -165,7 +193,17 @@ if [[ "${kprocs}" != "" ]]; then
fi

# clean up none drivers binding on 8443
# sudo lsof -i :8443 | tail -n +2 | awk '{print $2}' | xargs sudo -E kill -9
none_procs=$(sudo lsof -i :8443 | tail -n +2 | awk '{print $2}' || true)
if [[ "${none_procs}" != "" ]]; then
echo "Found stale api servers listening on 8443 processes to kill: "
for p in $none_procs
do
echo "Kiling stale none driver: $p"
sudo -E ps -f -p $p || true
sudo -E kill $p || true
sudo -E kill -9 $p || true
done
fi

function cleanup_stale_routes() {
local show="netstat -rn -f inet"
Expand Down Expand Up @@ -200,7 +238,7 @@ echo ">> Starting ${E2E_BIN} at $(date)"
${SUDO_PREFIX}${E2E_BIN} \
-minikube-start-args="--vm-driver=${VM_DRIVER} ${EXTRA_START_ARGS}" \
-minikube-args="--v=10 --logtostderr ${EXTRA_ARGS}" \
-test.v -test.timeout=90m -binary="${MINIKUBE_BIN}" && result=$? || result=$?
-test.v -test.timeout=100m -binary="${MINIKUBE_BIN}" && result=$? || result=$?
echo ">> ${E2E_BIN} exited with ${result} at $(date)"
echo ""

Expand Down

0 comments on commit ff14075

Please sign in to comment.