【发布时间】:2021-02-20 01:01:04
【问题描述】:
我有以下进行多阶段部署的模板:
parameters:
- name: Stage
type: string
- name: Environment
type: string
- name: Enabled
type: boolean
default: false
- name: WebAppName
type: string
- name: ArtifactName
type: string
stages:
- stage: ${{ parameters.Stage }}
displayName: '${{ parameters.Stage }} Stage'
dependsOn: '${{ parameters.DependsOn }}'
jobs:
- deployment: ${{ parameters.Environment }}
timeoutInMinutes: 70
environment: '${{ parameters.Environment }} Environment'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: ${{ parameters.ArtifactName }}
downloadPath: '$(System.ArtifactsDirectory)'
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'AzureConnectionSC'
appType: 'webApp'
WebAppName: ${{ parameters.WebAppName }}
package: '$(System.ArtifactsDirectory)/**/*.zip'
从我的管道中,我正在使用模板:
- template: azure-pipelines-multi-stage-release.yml # Template reference
parameters:
Environment: 'Dev'
Enabled: True
WebAppName: 'azureappservicehelloworldapp-dev'
Stage: 'Dev'
ArtifactName : 'helloWorldArtifact'
- template: azure-pipelines-multi-stage-release.yml # Template reference
parameters:
Environment: 'UAT'
Enabled: True
WebAppName: 'azureappservicehelloworld-uat'
Stage: 'UAT'
ArtifactName : 'helloWorldArtifact'
- template: azure-pipelines-multi-stage-release.yml # Template reference
parameters:
Environment: 'Prod'
Enabled: True
WebAppName: 'azureappservicehelloworld'
Stage: 'Prod'
ArtifactName : 'helloWorldArtifact'
如何将 DependsOn 传递到模板中,在 dev 中没有阶段依赖,因此它应该直接部署,但 UAT 依赖于 Dev,Prod 依赖于 UAT。如何将值传递给模板,如果没有传递任何内容,它应该继续部署,如果某些内容作为依赖项传递,它应该在安装之前验证该阶段。
【问题讨论】:
-
你检查过以下回复吗?你的问题解决了吗?
-
嗨 Cece Don,以下答案有所帮助,但它仍在继续下一步,无需等待依赖,我在环境管道下找到了一个解决方案,点击环境有一个名为批准和检查的设置我们可以在那里添加而不是依赖于.. 我会支持答案谢谢
标签: azure-devops azure-pipelines azure-pipelines-yaml