VSTS CI - 如何触发单个项目的构建

时间:2018-04-19 18:44:24

标签: tfs azure-devops tfsbuild

我正在使用Visual Studio Team Services构建定义触发器。我正在尝试为我的分支上的一个项目设置持续集成和交付(但不是包含许多项目的整个分支)。这将帮助我构建和发布个人微服务(当合同没有改变时......)。

我在这里或官方文档中找不到答案: Build definition triggers

我确实尝试过使用Path过滤器,但事实证明它并不是一种强大的方法。我可能弄错了......

enter image description here

任何指导将不胜感激。 Tnx提前

2 个答案:

答案 0 :(得分:2)

要仅在project3上进行更改时触发CI构建,您只能指定项目目录的路径过滤器。

如果您的仓库中的文件结构如下:

Root repo
    |___ project1
            |___ ...
    |___ project2
            |___ ...
    |___ project3
            |___ ...
    |___ project.sln
    |___...

然后您可以指定路径过滤器,如下所示:

enter image description here

要为持续部署上传仅project3的构建工件,您可以将相关文件从$(Build.SourcesDirectory)\project3复制到$(Build.ArtifactStagingDirectory),然后从$(Build.ArtifactStagingDirectory)上传构建工件。

答案 1 :(得分:1)

First, you have to specify the CI option and enable it. Enabling the "Batch changes while a build is in progress" is optional.

enter image description here

Add the branches you want to "Branch filters".

Then add the "Include" and the list of paths that you want to trigger the build.

Since you added to exclude all in your configurations (as in your question), the build cannot include the other directory.

You also don't need to specify the "*" in the path.

相关问题