Rotem Varon
Rotem Varon

Reputation: 1647

VSTS CI - how to trigger a build for single project

I am working with Visual Studio Team Services Build definition triggers. I am trying to set a Continuous Integration and Delivery for one project on my branch (but not the entire branch with many projects). This will help me build and release individual microservice (when the contract did not change...).

I could not find the answer here or on in the official docs: Build definition triggers

I did try to play with the Path filters but it has proven not to be a robust way. I might got it wrong...

enter image description here

Any guidance will be appreciated. Tnx in advance

Upvotes: 2

Views: 1414

Answers (2)

Rodrigo Werlang
Rodrigo Werlang

Reputation: 2176

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.

Upvotes: 1

Marina Liu
Marina Liu

Reputation: 38136

To trigger CI build only when changes made on project3, you can only specify the path filter to the project directory.

Such as if the file structure in your repo as below:

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

Then you can specify the path filter as below:

enter image description here

And to upload the build artifacts only about project3 for Continuous Deployment, you can copy related files from $(Build.SourcesDirectory)\project3 to $(Build.ArtifactStagingDirectory), and then upload build artifacts from $(Build.ArtifactStagingDirectory).

Upvotes: 2

Related Questions