基于多构建的VSTS发布阶段条件配置及自动化部署优化咨询
Triggering a VSTS Release Pipeline from Multiple Build Definitions
Hey Ryan, great question—setting up a release pipeline that triggers from any of your multiple builds (database, API, Web, and future ETL/report projects) is totally doable in Azure DevOps (formerly VSTS) with a couple of straightforward approaches. Let me break them down for you:
Option 1: Link Multiple Build Definitions to the Release's Continuous Deployment Trigger
This is the simplest way to get any of your builds to trigger the same release pipeline:
- Open your release pipeline for editing, then switch to the Triggers tab.
- Toggle on the Continuous deployment trigger if it's not already enabled.
- Click the Add button under "Build" and select each of your build definitions (database, API, Web, etc.) one by one.
- For each linked build, you can refine the trigger rules:
- Set the Branch filter to match the branches you want to trigger releases for (align this with your build definition's path filters to avoid unnecessary triggers).
- Choose to trigger only when the build succeeds (the default, which you'll likely want for production deployments).
- Once saved, any successful run of your linked builds will automatically trigger a new release of this pipeline.
Option 2: Fine-Grained Stage Triggers (For Targeted Deployments)
If you want different builds to trigger specific stages within your release pipeline (e.g., only the API build triggers the API deployment stage), use this approach:
- Link all build artifacts to your release pipeline:
- Go to the Artifacts tab of your release pipeline.
- Click Add, select each build definition as an artifact source, and configure the source branch and default version settings.
- Set stage-specific trigger conditions:
- For each stage in your pipeline, click the stage name and select Pre-deployment conditions.
- Under the Trigger section, select Artifact trigger.
- Choose the specific build definition that should trigger this stage, and set the condition (e.g., "Build succeeded").
- Repeat this for every stage you want to tie to a specific build.
- This way, when any of your builds completes, the release pipeline will start, but only the stages tied to that build will execute (you can also set fallback conditions if needed).
Key Notes to Keep in Mind
- Make sure each build definition is configured to publish artifacts correctly—your release pipeline needs access to these artifacts to deploy them.
- When adding future ETL/report build definitions, just repeat the steps above to link them to your release pipeline's triggers or artifacts.
- If you use branch policies, ensure your release trigger branch filters align with your build's path filters to avoid triggering releases for unrelated code changes.
内容的提问来源于stack exchange,提问作者Ryan
相关产品推荐
相关产品推荐

