Delete the msix blob if it's already there (#24353)

This commit is contained in:
Patrick Meinecke 2024-10-14 17:11:13 -04:00 committed by GitHub
parent 8b231fb49b
commit 14c82b568a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,8 +104,14 @@ jobs:
if ($env:BundleDir) {
$bundleFile = Get-Item "$env:BundleDir\*.msixbundle"
$blobName = $bundleFile | Split-Path -Leaf
$existing = Get-AzStorageBlob -Container $containerName -Blob $blobName -Context $storageContext -ErrorAction Ignore
if ($existing) {
Write-Verbose -Verbose "MSIX bundle already exists at '$storageAccount/$containerName/$blobName', removing first."
$existingBlob | Remove-AzStorageBlob -ErrorAction Stop -Verbose
}
Write-Verbose -Verbose "Uploading $bundleFile to $containerName/$blobName"
Set-AzStorageBlobContent -File $bundleFile -Container $containerName -Blob $blobName -Context $storageContext
Set-AzStorageBlobContent -File $bundleFile -Container $containerName -Blob $blobName -Context $storageContext -Force
}
else{
throw "BundleDir not found"