TryDeleteBlob
Builds are currently failing because we try to delete blobs that don't exist. This change logs & ignores the exception.
This commit is contained in:
parent
011b5590d7
commit
d9d6cbd6f1
2 changed files with 17 additions and 1 deletions
|
@ -75,7 +75,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
else
|
||||
{
|
||||
// This is an old drop of latest so remove all old files to ensure a clean state
|
||||
AzurePublisherTool.ListBlobs($"{targetContainer}").ToList().ForEach(f => AzurePublisherTool.DeleteBlob(f));
|
||||
AzurePublisherTool.ListBlobs($"{targetContainer}").ToList().ForEach(f => AzurePublisherTool.TryDeleteBlob(f));
|
||||
|
||||
// Drop the version file signaling such for any race-condition builds (see above comment).
|
||||
AzurePublisherTool.DropLatestSpecifiedVersion(targetVersionFile);
|
||||
|
|
|
@ -139,6 +139,22 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
}
|
||||
}
|
||||
|
||||
public bool TryDeleteBlob(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeleteBlob(path);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Deleting blob {path} failed with \r\n{e.Message}");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteBlob(string path)
|
||||
{
|
||||
_blobContainer.GetBlockBlobReference(path).DeleteAsync().Wait();
|
||||
|
|
Loading…
Reference in a new issue