Skip to content

Conversation

@JenGoldstrich
Copy link
Contributor

@JenGoldstrich JenGoldstrich commented Aug 28, 2025

This PR contains 2 main changes

  1. After the VHD unmanaged disk removals, acceptance tests started failing, this is due to the capture container name expected to be created before a build is started now, to fix this I added the capture container we'll use to the acceptance testing Terraform
  2. I also made a change to fix an issue caused by DiskRevokeAccess only being called after a copy is successful. If the copy fails (such as due to the above error where a user doesn't know they need to create a container now), we still need to Revoke the DIsk Access, otherwise deletion of the build disk will fail. To fix this I've moved this into the Cleanup of the CaptureImage step

…led on failures, clarify VHD requirements in v2.5.0
@JenGoldstrich JenGoldstrich requested a review from a team as a code owner August 28, 2025 22:03
@JenGoldstrich JenGoldstrich changed the title VHD Migrations Fixes - Acceptance Tests, and Disk Revoke Access on Failures VHD Migrations Fixes - VHD Acceptance Tests, and Disk Revoke Access on Failures Aug 28, 2025
}

func (*StepCaptureImage) Cleanup(multistep.StateBag) {
func (s *StepCaptureImage) Cleanup(state multistep.StateBag) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, when control + cing mid copy (a common thing users may do as the copy action takes a long time, and is prone to fail from time to time)

Cancelling build after receiving interrupt
==> azure-arm: failed to capture OS Disk with err : failed to copy to storage with err : error copying: waiting for file to copy: context canceled
==> azure-arm: Provisioning step had errors: Running the cleanup provisioner, if present...
==> azure-arm:
==> azure-arm: Deleting Virtual Machine deployment and its attached resources...
==> azure-arm: Deleted -> Microsoft.Compute/virtualMachines : 'pkrvmblsda6b8r9'
==> azure-arm: Deleted -> Microsoft.Network/networkInterfaces : 'pkrniblsda6b8r9'
==> azure-arm: Deleted -> Microsoft.Network/virtualNetworks : 'pkrvnblsda6b8r9'
==> azure-arm: Deleted -> Microsoft.Network/publicIPAddresses : 'pkripblsda6b8r9'
==> azure-arm: Deleted -> Microsoft.Network/networkSecurityGroups : 'pkrsgblsda6b8r9'
==> azure-arm: Error deleting resource. Please delete manually.
==> azure-arm:
==> azure-arm: Name: /subscriptions/4712c895-8c02-49ab-b48c-9a3396eb6a78/resourceGroups/pkr-Resource-Group-blsda6b8r9/providers/Microsoft.Compute/disks/pkrosblsda6b8r9
==> azure-arm: Error: performing Delete: unexpected status 409 (409 Conflict) with error: OperationNotAllowed: There is an active shared access signature outstanding for disk pkrosblsda6b8r9. Call EndGetAccess before attaching or deleting the disk. Learn more here: aka.ms/revokeaccessapi.
==> azure-arm: performing Delete: unexpected status 409 (409 Conflict) with error: OperationNotAllowed: There is an active shared access signature outstanding for disk pkrosblsda6b8r9. Call EndGetAccess before attaching or deleting the disk. Learn more here: aka.ms/revokeaccessapi.
==> azure-arm: Removing the created Deployment object: 'pkrdpblsda6b8r9'
==> azure-arm:
==> azure-arm: Deleting KeyVault created during build
==> azure-arm: Deleted -> Microsoft.KeyVault/vaults : 'pkrkvblsda6b8r9'
==> azure-arm: Removing the created Deployment object: 'kvpkrdpblsda6b8r9'
==> azure-arm:
==> azure-arm: Cleanup requested, deleting resource group ...

And then the resource group does not delete.

vs after:

Cancelling build after receiving interrupt
==> azure-arm: failed to capture OS Disk with err : failed to copy to storage with err : error copying: waiting for file to copy: context canceled
==> azure-arm: Revoking access ...
==> azure-arm: Provisioning step had errors: Running the cleanup provisioner, if present...
==> azure-arm:
==> azure-arm: Deleting Virtual Machine deployment and its attached resources...
==> azure-arm: Deleted -> Microsoft.Compute/virtualMachines : 'pkrvmuyw5ff2drx'
==> azure-arm: Deleted -> Microsoft.Network/networkInterfaces : 'pkrniuyw5ff2drx'
==> azure-arm: Deleted -> Microsoft.Network/virtualNetworks : 'pkrvnuyw5ff2drx'
==> azure-arm: Deleted -> Microsoft.Network/publicIPAddresses : 'pkripuyw5ff2drx'
==> azure-arm: Deleted -> Microsoft.Network/networkSecurityGroups : 'pkrsguyw5ff2drx'
==> azure-arm: Deleted -> Microsoft.Compute/disks : '/subscriptions/4712c895-8c02-49ab-b48c-9a3396eb6a78/resourceGroups/pkr-Resource-Group-uyw5ff2drx/providers/Microsoft.Compute/disks/pkrosuyw5ff2drx'
==> azure-arm: Removing the created Deployment object: 'pkrdpuyw5ff2drx'
==> azure-arm:
==> azure-arm: Deleting KeyVault created during build
==> azure-arm: Deleted -> Microsoft.KeyVault/vaults : 'pkrkvuyw5ff2drx'
==> azure-arm: Removing the created Deployment object: 'kvpkrdpuyw5ff2drx'
==> azure-arm:
==> azure-arm: Cleanup requested, deleting resource group ...
==> azure-arm: Resource group has been deleted.
Build 'azure-arm' errored after 3 minutes 55 seconds: failed to capture OS Disk with err : failed to copy to storage with err : error copying: waiting for file to copy: context canceled

Copy link
Contributor

@tanmay-hc tanmay-hc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jenna,
Thanks for fixing this. The changes looks good to me.
Also tried the acceptance tests and they are working now.

@tanmay-hc tanmay-hc merged commit 0a93eab into main Aug 29, 2025
12 checks passed
@tanmay-hc tanmay-hc deleted the fix_acc_test_vhd_changes branch August 29, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants