大约一小时后,azureupload 大文件失败,错误代码为 403

azureupload fails for big files with error code 403 after an hour or so

将 Jenkins 2.222.3 与插件一起使用 Windows Azure 存储 1.1.7

azureupload 适用于小文件。但是对于大文件(我的测试是 12GB 的数据),大约一个小时后上传失败并显示以下消息。

在 Azure 门户上通过浏览器上传不会失败。

09:20:36  MicrosoftAzureStorage - Uploading files to Microsoft Azure  
10:21:22  ERROR: MicrosoftAzureStorage - Error occurred while uploading to Azure - <storage_account_id>  
10:21:22  com.microsoftopentechnologies.windowsazurestorage.exceptions.WAStorageException: Fail to upload individual files to blob  
10:21:22    at com.microsoftopentechnologies.windowsazurestorage.service.UploadToBlobService.uploadIndividuals(UploadToBlobService.java:151)  
10:21:22    at com.microsoftopentechnologies.windowsazurestorage.service.UploadService.execute(UploadService.java:719)  
10:21:22    at com.microsoftopentechnologies.windowsazurestorage.WAStoragePublisher.perform(WAStoragePublisher.java:438)  
10:21:22    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)  
10:21:22    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)  
10:21:22    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start[=10=](SynchronousNonBlockingStepExecution.java:47)  
10:21:22    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)  
10:21:22    at java.util.concurrent.FutureTask.run(Unknown Source)  
10:21:22    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
10:21:22    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
10:21:23    at java.lang.Thread.run(Unknown Source)  

10:21:23  Caused by: java.io.IOException: java.util.concurrent.ExecutionException:   com.microsoftopentechnologies.windowsazurestorage.exceptions.WAStorageException: Failed to upload test_upload/full.zip with error code 403  
10:21:23    at com.microsoftopentechnologies.windowsazurestorage.service.UploadService$UploadOnSlave.invoke(UploadService.java:373)  
10:21:23    at com.microsoftopentechnologies.windowsazurestorage.service.UploadService$UploadOnSlave.invoke(UploadService.java:346)

您收到的错误代码是 403。Http 403 表示禁止。

可能发生的情况是您的身份验证令牌将在 1 小时后过期。另一种选择是它与 blob 的租约有关。

Many Azure services have Jenkins plugins. Some of these plugins will be out of support as of February 29, 2024. Azure CLI is the currently recommended way to integrate Jenkins with Azure services.

https://docs.microsoft.com/en-us/azure/developer/jenkins/azure-storage-blobs-as-build-artifact-repository

我建议您使用 Azure CLI 而不是插件上传文件。