英文:
Can an Azure YAML Pipelines deployment job type, have mutiple environment values?
问题
在部署作业的环境属性中是否有可能拥有多个值?类似于这个示例:
stages:
- stage:
jobs:
- deployment:
environment:
- environmentOne
- environmentTwo
strategy:
runOnce:
deploy:
steps:
- script: echo hello
微文档没有提到这一点。我还发现了这篇博客文章,但对于我的情况,环境的唯一目的是用于执行环境的批准和检查。
英文:
Is there any possibility to have mutiple values in the environment property of deployment jobs? Something similar to this example:
stages:
- stage:
jobs:
- deployment:
environment:
- environmentOne
- environmentTwo
strategy:
runOnce:
deploy:
steps:
- script: echo hello
Micro doc do not make any allusion about that. I also found this blog, but for my case, the only porpuse of the environments is for the execution of the environment approvals and checks
答案1
得分: 1
最简化的解决方案只需使用each关键字和对象参数来指定环境。
parameters:
- name: environments
type: object
default:
- environmentOne
- environmentTwo
stages:
- stage:
jobs:
- ${{ each environment in parameters.environments }}:
- deployment:
environment: ${{ environment }}
strategy:
runOnce:
deploy:
steps:
- script: echo hello
英文:
The most simplified solution would be just to use the each keyword and object parameter to specify the environments.
parameters:
- name: environments
type: object
default:
- environmentOne
- environmentTwo
stages:
- stage:
jobs:
- ${{ each environment in parameters.environments }}:
- deployment:
environment: ${{ environment }}
strategy:
runOnce:
deploy:
steps:
- script: echo hello
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论