-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: [arm builder] storage blob VHD deletion, cleanup post build deletion #410
fix: [arm builder] storage blob VHD deletion, cleanup post build deletion #410
Conversation
1134baf
to
94d542c
Compare
storageAccountAuthorizer, err := commonclient.BuildStorageAuthorizer(ctx, authOptions, *cloud) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
blobClient, err := giovanniBlobStorageSDK.NewWithBaseUri(cloud.Storage.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually was just passing in "AzureStorage" as a string, however the client never invoked this so we never ran into the issue since Delete blobs endpoint previously accepted storage account, now we had to give it this URL.
See https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview#standard-endpoints for more info
@@ -143,7 +143,7 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) { | |||
|
|||
err := s.deleteImage(ctx, additionaldisk, resourceGroupName, (isManagedDisk || isSIGImage), subscriptionId, armStorageAccountName) | |||
if err != nil { | |||
s.say("Failed to delete the managed Additional Disk!") | |||
s.say(fmt.Sprintf("Failed to delete the managed Additional Disk! %s", err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We weren't actually logging the error here 🤦♀️
@@ -22,7 +22,7 @@ require ( | |||
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240411.1145857 | |||
github.com/hashicorp/go-azure-sdk/sdk v0.20240411.1145857 | |||
github.com/mitchellh/go-homedir v1.1.0 | |||
github.com/tombuildsstuff/giovanni v0.25.3 | |||
github.com/tombuildsstuff/giovanni v0.26.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update isn't required, I was just seeing when the change was introduced and figured I'd upgrade while testing
b4959b7
to
f555542
Compare
@@ -191,9 +274,6 @@ func (s *StepDeployTemplate) getImageDetails(ctx context.Context, subscriptionId | |||
defer cancel() | |||
vmID := virtualmachines.NewVirtualMachineID(subscriptionId, resourceGroupName, computeName) | |||
vm, err := s.client.VirtualMachinesClient.Get(pollingContext, vmID, virtualmachines.DefaultGetOperationOptions()) | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was invalid code, the lower error was unreachable
0d99043
to
5362dbe
Compare
s.reportResourceDeletionFailure(err, resourceName) | ||
} | ||
return err | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiniest of nits: extra blank line here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few last nits, but overall this LGTM!
0eebcbe
to
a542433
Compare
9ed6f31
to
8090c68
Compare
This PR has three main purposes
Closes #409
Closes #273
Before this PR when building a VHD image with additional disks that should be deleted, you can see extra print statements at the bottom of 2, and my storage account as well as the failed additional disk deletion, and NIC repeated retry errors.
After