gpt4 book ai didi

Azure Devops YAML 多阶段管道工件问题

转载 作者:行者123 更新时间:2023-12-03 02:46:22 27 4
gpt4 key购买 nike

在进行 ARM 部署时,我的 Azure Devops YAML 多阶段管道出现错误。问题是从构建中下载工件。请参阅此处的错误:

Error

看起来工件在下载之前并未在作业中下载。不同之处在于,生产部署需要获得批准,因此它位于 -deployment 内,而不是在 -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'

最佳答案

documentation on deployment jobs表明您可能不需要指示它下载工件,它会自动发生?

deploy: Used to run steps that deploy your application. Download artifact task will be auto injected only in the deploy hook for deployment jobs. To stop downloading artifacts, use - download: none or choose specific artifacts to download by specifying Download Pipeline Artifact task.

关于Azure Devops YAML 多阶段管道工件问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58536892/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com