azure - Azure Devops YAML 多阶段管道工件问题
问题描述
在进行 ARM 部署时,我的 Azure Devops YAML 多阶段管道给了我一个错误。问题是从构建中下载工件。在此处查看错误:
看起来工件没有被下载,在它们被下载之前的作业中。不同之处在于生产部署需要获得批准,因此它在 a-deployment
中而不是在 a 中-job
。
请参阅此处的代码:
- stage: Deploy_Prod
dependsOn: Deploy_Acc
# Only deploy when build is from master
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
jobs:
- deployment: 'Deploy_Prod'
pool:
vmImage: 'ubuntu-latest'
# Set envrironment for approval, see https://dev.azure.com/dept/DTNL%20-%20CBRE/_environments/5?view=resources
environment: cbre_prod
strategy:
runOnce:
deploy:
steps:
# Download build artifact
- download: current
artifact: Templates
# Deploy production infra
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Deploy production infrastructure'
inputs:
deploymentScope: 'Resource Group'
ConnectedServiceName: '***'
subscriptionName: '***'
action: 'Create Or Update Resource Group'
resourceGroupName: '***'
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: 'azuredeploy.json'
csmParametersFile: 'azuredeploy-parameters-prod.json'
deploymentMode: 'incremental'
有谁知道我如何从多阶段管道下载工件,同时使用-deployment
而不是-job
?
带作业的工作版本,仅供参考:
- stage: Deploy_Acc
dependsOn: Deploy_Test
# Only deploy when build is from master
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
jobs:
- job: 'Deploy_Acc'
pool:
vmImage: 'ubuntu-latest'
steps:
# Download build artifact
- download: current
artifact: Templates
# Deploy acceptation infra
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Deploy acceptation infrastructure'
inputs:
deploymentScope: 'Resource Group'
ConnectedServiceName: '***'
subscriptionName: '***'
action: 'Create Or Update Resource Group'
resourceGroupName: '***-acc'
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: 'azuredeploy.json'
csmParametersFile: 'azuredeploy-parameters-acc.json'
deploymentMode: 'incremental'
解决方案
部署作业的文档表明您可能不需要指示它下载工件,它会自动发生吗?
deploy
:用于运行部署应用程序的步骤。下载工件任务将仅在部署作业的部署挂钩中自动注入。要停止下载工件,- download: none
请通过指定下载管道工件任务来使用或选择要下载的特定工件。
推荐阅读
- c++ - 为 Win IoT Core 构建 ARM 会出现“不支持”错误
- cuda - 内核启动后,Nvidia 视觉分析器未显示 cudaMalloc()
- angular - 在 Angular/Symfony 应用程序中注册用户
- primeng-turbotable - Turbotable : p-tableHeaderCheckbox 选择禁用的行
- python - 多对多字段的 Django 表单上的逗号分隔文本而不是多项选择
- outlook-addin - Microsoft Office 商店应用已获批准但不可见
- javascript - 如何在javascript中停止浏览器选项卡更改事件
- sql - 使用依赖于另一个元素的查询
- java - 如何从 MongoDB 中检索特定的元素列表?
- wordpress - Wordpress 总是重定向到 /wp-login.php