在 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 - 使用 AzureFileCopy 任务覆盖 Azure Blob 存储中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69608251/