如何在 yaml 管道中指定动态值作为虚拟机资源的环境名称
我们计划将发布管道移至 yaml,并且我们已做好准备。
我有多个环境,例如开发、测试和生产,我尝试对所有环境使用相同的部署作业模板。
jobs:
- deployment: deploy
displayName: Deploy
environment:
name: dev # This should be replaced with environment specific variable
resourceType: VirtualMachine
tags: WEB01
在上面的代码中,我的目的是提供名称作为环境特定变量。有人可以帮忙吗?
谢谢你!
We are planning to move our release pipelines to yaml and we are ready with it.
I have multiple environments like dev, test and prod where I'm trying to use same deployment job templates for all environments.
jobs:
- deployment: deploy
displayName: Deploy
environment:
name: dev # This should be replaced with environment specific variable
resourceType: VirtualMachine
tags: WEB01
In above code, my intension is to provide name as environment specific variable. Could someone pls help?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用参数来执行此操作,但需要使用编译管道时计算的表达式语法
You can do this with parameters, but you need to use the expression syntax which is evaluated when the pipeline is compiled
您可能会喜欢我在另一篇文章中的回答。它会在每个环境中进行阶段并获得批准。
https://stackoverflow.com/a/74159554/4485260
You might like my answer in another post. it does stages per environment with approvals.
https://stackoverflow.com/a/74159554/4485260