2020-06-09 03:06:48 +02:00
|
|
|
jobs:
|
|
|
|
- job: DeleteBlob
|
2020-08-10 18:07:58 +02:00
|
|
|
variables:
|
2021-03-02 01:33:22 +01:00
|
|
|
- name: runCodesignValidationInjection
|
|
|
|
value : false
|
|
|
|
- name: NugetSecurityAnalysisWarningLevel
|
|
|
|
value: none
|
2021-03-08 19:20:16 +01:00
|
|
|
- group: Azure Blob variable group
|
2020-06-09 03:06:48 +02:00
|
|
|
displayName: Delete blob is exists
|
|
|
|
pool:
|
|
|
|
vmImage: windows-latest
|
|
|
|
steps:
|
2020-10-23 20:42:24 +02:00
|
|
|
- checkout: self
|
|
|
|
clean: true
|
2021-04-23 01:30:51 +02:00
|
|
|
|
2020-06-09 03:06:48 +02:00
|
|
|
- template: SetVersionVariables.yml
|
|
|
|
parameters:
|
|
|
|
ReleaseTagVar: $(ReleaseTagVar)
|
2021-04-23 01:30:51 +02:00
|
|
|
CreateJson: yes
|
|
|
|
UseJson: no
|
2020-06-09 03:06:48 +02:00
|
|
|
|
|
|
|
- task: AzurePowerShell@4
|
|
|
|
inputs:
|
|
|
|
azureSubscription: '$(AzureFileCopySubscription)'
|
|
|
|
scriptType: inlineScript
|
|
|
|
azurePowerShellVersion: latestVersion
|
|
|
|
inline: |
|
|
|
|
try {
|
|
|
|
$container = Get-AzStorageContainer -Container '$(AzureVersion)' -Context (New-AzStorageContext -StorageAccountName '$(StorageAccount)') -ErrorAction Stop
|
|
|
|
|
|
|
|
if ($container -ne $null -and '$(ForceAzureBlobDelete)' -eq 'false') {
|
|
|
|
throw 'Azure blob container $(AzureVersion) already exists. To overwrite, use ForceAzureBlobDelete parameter'
|
|
|
|
}
|
|
|
|
elseif ($container -ne $null -and '$(ForceAzureBlobDelete)' -eq 'true') {
|
|
|
|
Write-Verbose -Verbose 'Removing container $(AzureVersion) due to ForceAzureBlobDelete parameter'
|
|
|
|
Remove-AzStorageContainer -Name '$(AzureVersion)' -Context (New-AzStorageContext -StorageAccountName '$(StorageAccount)') -Force
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
if ($_.FullyQualifiedErrorId -eq 'ResourceNotFoundException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageContainerCommand') {
|
|
|
|
Write-Verbose -Verbose 'Container "$(AzureVersion)" does not exists.'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
throw $_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|