Azure DevOps条件生成步骤

时间:2019-05-06 05:12:08

标签: azure-devops

我有两个项目的解决方案。

Integration.Api
Integration.Common

在Azure DevOps中,我有为Integration.Api项目运行的步骤,也有以下构建步骤为Integration.Common项目创建NuGet包:

dotnet Pack Common
dotnet Nuget Push

我应在“自定义条件”文本框中添加什么,以便仅在Integration.Common项目已更改的情况下运行该步骤?即。我仍然希望在Integration.Api发生更改的情况下运行构建,但是我只希望在Integration.Common发生更改的情况下运行dotnet Pack步骤。 Azure DevOps

2 个答案:

答案 0 :(得分:1)

  

我应该在“自定义条件”文本框中添加什么,以便仅在Integration.Common项目已更改的情况下才能运行该步骤?

没有这样的即用型表达式。

但是您可以使用powershell脚本提取修改后的文件,并启用相应的变量,然后根据变量的值在自定义条件文本框中添加表达式。

门票:Conditional build solution in Azure DevOps

希望这会有所帮助。

答案 1 :(得分:0)

非常确定您需要将条件置于构建而不是步骤上。将这样的触发条件放在要构建通用组件的构建上。

trigger:
  paths:
    include:
    - /path/to/common/*

https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#triggers