问题描述
我想使用Azure DevOps管道将故事书的静态版本部署到Azure云存储blob容器。
SourcePath(或上图中的Source)必须是要复制到Blob的文件/文件夹的绝对路径。 我指的是: https://github.com/microsoft/azure-pipelines-tasks/edit/master/Tasks/AzureFileCopyV4/README.md https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?tabs=yaml&view=azure-devops 和其他各种来源。 无论我尝试使用什么预定义变量,我总是会看到相同的错误:
Failed to perform copy command due to error: cannot start job due to error: cannot scan the path \\?\D:\a\1\dist-storybook,please verify that it is a valid.
这是我到目前为止所尝试的:
- task: AzureFilecopy@4
inputs:
# SourcePath: '$(Build.Repository.LocalPath)/dist-storybook'
# SourcePath: '$(Build.sourcesDirectory)/dist-storybook'
SourcePath: '$(Agent.BuildDirectory)/dist-storybook'
# SourcePath: '$(System.DefaultWorkingDirectory)/dist-storybook'
azureSubscription: 'xxx'
Destination: 'AzureBlob'
storage: 'xxx'
ContainerName: 'storybook'
在进行注释之前,请检查dist-storybook文件夹是否存在以及我是否已验证。
是的,它存在。在尝试执行Azure File copy v4任务之前,我将AzureRmWebAppDeployment
任务与以下参数一起使用:packageForLinux: '$(System.DefaultWorkingDirectory)/dist-storybook'
(部署到Azure App Service [但是对于Storybook,这是一个过大的选择,因为生成的Storybook由静态文件组成并且不需要服务器运行]),并且它已成功部署了Storybook。因此dist-storybook
是在管道的上一步中正确生成的。
有人有任何线索吗?
更新:
在Microsoft开发者论坛上获得一些帮助后:
我开始将任务的v3(AzureFilecopy @ 3)与$(Build.Repository.LocalPath)
预定义系统变量一起使用(我已经在v4 [AzureFilecopy @ 4]中使用了该变量,但未成功使用)
这是完整的任务:
- task: AzureFilecopy@3
inputs:
SourcePath: '$(Build.Repository.LocalPath)/dist-storybook/*'
azureSubscription: 'xxx'
Destination: 'AzureBlob'
storage: 'xxx'
ContainerName: 'storybook'
现在我收到此错误:
2020-09-30T09:19:03.1646485Z ##[section]Starting: AzureFilecopy
2020-09-30T09:19:03.1870156Z ==============================================================================
2020-09-30T09:19:03.1871285Z Task : Azure file copy
2020-09-30T09:19:03.1872336Z Description : copy files to Azure Blob Storage or virtual machines
2020-09-30T09:19:03.1873312Z Version : 3.175.2
2020-09-30T09:19:03.1874422Z Author : Microsoft Corporation
2020-09-30T09:19:03.1876194Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-09-30T09:19:03.1877411Z ==============================================================================
2020-09-30T09:19:06.0053519Z ##[command]Import-Module -Name C:\modules\azurerm_6.13.1\AzureRM\6.13.1\AzureRM.psd1 -Global
2020-09-30T09:19:29.9367823Z ##[command]Clear-AzureRmContext -Scope Process
2020-09-30T09:19:31.1812482Z ##[command]Clear-AzureRmContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2020-09-30T09:19:32.3448727Z ##[command]Add-AzureRMAccount -ServicePrincipal -Tenant *** -Credential System.Management.Automation.PSCredential -Environment AzureCloud
2020-09-30T09:19:34.2134374Z ##[command] Set-AzureRmContext -SubscriptionId 5a6f9ac1-3fc5-4ecc-9909-7c1f7be55b1f -TenantId ***
2020-09-30T09:19:41.8630229Z Uploading files from source path: 'D:\a\1\s\dist-storybook\*' to storage account: 'stdesignsystemdevuksouth' in container: 'storybook' with blob prefix: ''
2020-09-30T09:19:41.9074144Z ##[command] & "Azcopy\Azcopy.exe" /Source:"D:\a\1\s\dist-storybook\*" /Dest:"https://stdesignsystemdevuksouth.blob.core.windows.net/storybook" /@:"D:\a\_temp\9a9dd952-202a-4851-91ed-e27a062f8f4a" /XO /Y /SetContentType /Z:"Azcopy" /V:"Azcopy\AzcopyVerbose_a1f6be33-1856-4036-98e1-d6c9c5a151af.log" /S
2020-09-30T09:19:42.8784330Z [2020/09/30 09:19:42][ERROR] Error parsing source location "D:\a\1\s\dist-storybook\*": Failed to enumerate directory D:\a\1\s\dist-storybook\*\ with file pattern *. The system cannot find the path specified. (Exception from HRESULT: 0x80070003) For more details,please type "Azcopy /?:Source" or use verbose option /V.
2020-09-30T09:19:43.1065203Z ##[command]disconnect-AzureRmAccount -Scope Process -ErrorAction Stop
2020-09-30T09:19:43.9220995Z ##[command]Clear-AzureRmContext -Scope Process -ErrorAction Stop
2020-09-30T09:19:44.4426511Z ##[error]Upload to container: 'storybook' in storage account: 'stdesignsystemdevuksouth' with blob prefix: '' Failed with error: 'Azcopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-09-30T09:19:44.5187191Z ##[section]Finishing: AzureFilecopy
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)