Drone: Cleanup E2E VMs on test panic (#7104)

* Cleanup leftover VMs in E2E pipeline

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola 2023-03-17 11:35:05 -07:00 committed by GitHub
parent 9980504196
commit 561ec056c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -665,6 +665,22 @@ platform:
arch: amd64
steps:
- name: skipfiles
image: plugins/git
commands:
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
- if [ -z "$DIFF" ]; then
echo "All files in PR are on ignore list";
exit 78;
else
echo "Some files in PR are not ignored, $DIFF";
fi;
when:
event:
- push
- pull_request
- name: build-e2e-image
image: rancher/dapper:v0.5.0
commands:
@ -692,13 +708,22 @@ steps:
- docker run -d -p 5000:5000 -e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io --name registry registry:2
- cd tests/e2e/validatecluster
- vagrant destroy -f
- go test -v -timeout=30m ./validatecluster_test.go -ci -local
- go test -v -timeout=45m ./validatecluster_test.go -ci -local
- cd ../secretsencryption
- vagrant destroy -f
- go test -v -timeout=30m ./secretsencryption_test.go -ci -local
- cd ../upgradecluster
- E2E_RELEASE_CHANNEL="latest" go test -v -timeout=45m ./upgradecluster_test.go -ci -local
- docker stop registry && docker rm registry
# Cleanup any VMs still running, happens if a test panics
- VMS=$(virsh list --name | grep '_server-\|_agent-' || true)
- |
for vm in $VMS
do
virsh destroy $vm
virsh undefine $vm --remove-all-storage
done
volumes:
- name: libvirt
path: /var/run/libvirt/