azure - 使用 AzureFileCopy 任务覆盖 Azure Blob 存储中的文件

标签 azure azure-devops azure-pipelines azure-blob-storage azure-pipelines-tasks

在 Azure Pipelines 中,我们可以使用以下任务将文件上传到 Blob 存储:

- task: AzureFileCopy@4
  inputs:
    SourcePath: 'MyInstaller.tar.gz'
    azureSubscription: 'Azure subscription 1(qwerty)'
    Destination: 'AzureBlob'
    storage: 'qwertyuiop'
    ContainerName: 'qwertyuiop'

我注意到,如果文件名相同,那么该文件会在容器中被覆盖,这很有用,因为我可以让我的实时发布管道覆盖该文件,以便用户始终获得我的软件的最新版本.

但是,如果用户当前正在下载文件并且该文件被新版本覆盖,会发生什么情况?会不会下载失败?微软有这方面的文档吗?

最佳答案

对于 block blob,下载的可能是旧版本,直到最终 block 提交。最终的 PutBlockList 操作将以原子方式将 blob 更新到新版本。

对于大型 blob,可能需要一些时间才能完成该过程,因此如果没有版本更改,则会按原样下载。当有版本更改时,如果未设置任何类型的并发,则默认情况下会并行覆盖数据如果版本发生变化且兼容性不匹配,则下载时可能会出现内部错误。

请查看managing concurrency上的引用文档在 azure 的存储中,表示重写取决于访问条件。

The Storage service assigns an identifier to every object stored which gets updated every time any change or update happens on that object. The identifier is returned to the client as part of an HTTP GET response using the ETag (entity tag) header that is defined within the HTTP protocol. A user performing an update on such an object can send in the original ETag along with a conditional header to ensure that an update will only occur if a certain condition has been met . The condition is in the form of “If-Match” header which requires to match Etag in update request as in the Storage Service .If certain conditions doesn’t match , the process may get interrupted and return errors .

引用: azure-blob-availability-during-an-overwrite-SO

关于azure - 使用 AzureFileCopy 任务覆盖 Azure Blob 存储中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69608251/

相关文章:

python - 用于访问用户 OneDrive 的 Microsoft Graph API 代码库解决方案

azure - 如何在 Azure DevOps 中动态创建功能分支的应用程序服务

azure - 如何获取事件版本所基于的分支的名称?

asp.net - VSTS 构建定义组织 ID 错误

azure-pipelines - 如何在 Azure DevOps 管道中使用手动验证任务?

asp.net - Azure 和 Microsoft ASP.NET MVC

azure - asp.net core 2.0 的 DevOps 构建问题

azure - 复制 Azure 数据仓库中所有 DWU 中的查找表

tfs - 检查 TFS 中的当前进程模板

azure - 自动化测试在 Azure 中失败,但该步骤的结果是通过,这是为什么?