diff --git a/ci/ci-box-bats.sh b/ci/ci-box-bats.sh index 044a20a9..d57ab87f 100755 --- a/ci/ci-box-bats.sh +++ b/ci/ci-box-bats.sh @@ -19,7 +19,12 @@ trap cleanup EXIT echo $CANDIDATE_BUILD_NUMBER -vagrant destroy local -f +running_virtualbox_vm_pid=`ps x | grep bosh-lite | grep startvm | cut -d ' ' -f2` +running_vmware_vm_pid=`ps x | grep bosh-lite | grep vmware-vmx | cut -d ' ' -f2` +if [ ! -n "$running_virtualbox_vm_pid" ] || [ ! -n "$running_vmware_vm_pid" ]; then + vagrant destroy local -f +fi + rm -rf /var/lib/jenkins/.bosh_cache/* || true vagrant box add bosh-lite-${BOX_TYPE}-ubuntu-trusty-${CANDIDATE_BUILD_NUMBER}.box --name bosh-lite-ubuntu-trusty --force