Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Azure driver: Fix issue #3976 #4249
This PR will fix #3976
The current driver behavior does not delete the empty storage accounts. This will mess up your Microsoft Azure cloud resource group, like I wrote it as comment on the referenced issue. The current behavior will produce the following result if you, like we do, use for example Gitlab autoscaling runners.
What I've done
I added a functionality which checks, if there are storage blobs left over in the associated storage account of the virtual machine, after the virtual machine is deleted. If there are no container items left in the storage account, this PR will delete the corresponding storage account.
How it is done
I modified the removeOSDiskBlob method and used the already existing client methods to retrieve a list of the containers associated with the storage account. If the retrieved list is empty, after the deletion of the virtual machine, the PR deletes the storage account too with the appropriate methods.
No more dangling storage accounts.