问题
I have a repository with two solutions in it. Both solution files exist in the root directory, essentially like this:
/WebsiteOneDirectory/
/WebsiteTwoDirectory/
/.gitignore
/WebsiteOne.sln
/WebsiteTwo.sln
Is it possible for me to build multiple pipelines pointed at this repository to build the different solutions? When I create my first pipeline it is generating a azure-pipelines.yml file for the repo, so I am unsure how/if I am going to be able to have multiple pipeline configurations if that is a fixed name it expects.
回答1:
Yes, you can use path filters in your trigger
Edit your build and go to the Triggers tab. Here you can add or remove branches, and also add path filters.
You have the option to either explicitly include or exclude paths. In the image below you can see that I'm explicitly excluding the "docs" folder from the master branch.
回答2:
In addition to James Reed's answer, if you prefer using the .yml
files, what I would recommend is to create multiple .yml
definitions, one for each pipeline.
Here's what one would look like:
trigger:
branches:
include:
- master
paths:
include:
- WebsiteOneDirectory/*
exclude:
- WebsiteTwoDirectory/*
For building, you'd need to specify which solution to build. For a (.net core) example:
variables:
buildConfiguration: 'Release'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- script: dotnet build WebsiteOne --configuration $(buildConfiguration)
来源:https://stackoverflow.com/questions/53012697/can-i-have-multiple-build-pipelines-for-the-same-repository