如何从发布中即时排除部署组目标 [英] How exclude Deployment Group Target from Release on the fly

查看:38
本文介绍了如何从发布中即时排除部署组目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有X个服务器的部署组.
我已经创建并设置了发布管道,使其可以按预期工作.
当我运行它时,它会部署到我的部署"组下的所有服务器.(我确实按特定标签过滤,但这无关紧要)

I have a Deployment Group with X number of servers.
I've created and set up my Release Pipeline to work as expected.
When I run it, it deploys to all servers under my Deployment group. (I do filter by specific Tags but that's irrelevant)

我现在需要的是能够在部署期间动态过滤/排除服务器(例如:仅在第一台服务器上部署,其余的保持不变)

What I need now, is to be able to filter/exclude servers on the fly during deployments (for example: deploy only on the first server and leave the rest unchanged)

类似以下的内容(截取自支持此功能的Octopus的屏幕截图)

Something like the below (screenshot taken from Octopus which supports this functionality)

我正试图将一些版本定义从Octopus迁移到Azure Pipelines,这使我受阻.

I'm trying to migrate a few Release Definitions from Octopus to Azure Pipelines and this is blocking me.

推荐答案

由于Azure Pipelines不支持,因此我最终使用了一种解决方法:

Since this is not supported by Azure Pipelines, I ended up using a workaround:

  1. 创建一个包含我的4个服务器名称的管道变量.

  1. Create a Pipeline Variable that contains my 4 server names.

在我的步骤中添加自定义条件
'and(succeeded(),contains(variables ['IncludedServers'],variables ['Agent.MachineName']))

Add a Custom condition on my steps
'and(succeeded(), contains(variables['IncludedServers'],variables['Agent.MachineName']))

3.创建发行版时,如有必要,请编辑变量

3.Edit the variable, if necessary, when creating a release

我确实想改进一些内容,例如contains表达式,这样当我拥有子字符串时不会出现误报的问题.

I do want to improve a few things, like the contains expression so that there are no problems with false positives when I have substrings.

由于输入错误的可能性,它并不完美,但这可能是可以接受的解决方法.希望微软会为此提供官方支持.

It's not perfect, because of the possibilities of typos but it's probably an acceptable workaround. Hopefully Microsoft will add official support for this.

我再次在此处添加功能请求链接,如果觉得有用,请投票.
允许用户排除部署目标从即时发布

I'm adding the feature request link again here, upvote if you find this useful.
Allow users to Exclude Deployment Targets from Release on the fly

这篇关于如何从发布中即时排除部署组目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆