You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSTS链式构建场景下每次推送触发两次构建问题咨询

Fix: Double Build Triggers in VSTS Chained Build Scenario

Hey there, let's tackle that double build trigger issue you're facing. You've set up a chained build where "Sync VSTS to GitHub" (CI-triggered) pushes changes to GitHub and triggers "Proper Build"—but every repo push ends up firing two builds instead of just the intended chain. Here are the most common culprits and fixes:

1. Verify "Proper Build" has no unintended triggers

First, double-check that "Proper Build" isn't set to trigger on its own, even if you thought you disabled CI:

  • Open the edit page for "Proper Build" and go to the Triggers tab
  • Make sure the Continuous integration option is unchecked
  • Next, check your branch policies: If your target branch (like main) has a "Require a build to pass before merging" rule linked to "Proper Build", every push will trigger this build automatically alongside your "Sync" CI build. To fix this:
    • Head to your repo's Branch Policies (Repo → Branches → Select your target branch → Policies)
    • Either remove "Proper Build" as the required build for the branch, or switch it to use "Sync VSTS to GitHub" instead (if that aligns with your workflow)

2. Check if your Sync script is creating new VSTS commits

If your PowerShell script modifies files in the VSTS repo (like updating version numbers) and commits those changes when pushing to GitHub, that new commit will trigger another "Sync VSTS to GitHub" build—creating a loop that causes two builds.

  • Look at the trigger reason for both builds in your VSTS build history:
    • If the first build says "User push" and the second says "Push from [your script's commit]", this is the issue
  • Fix it by:
    • Adjusting your PowerShell script to avoid making changes to the VSTS repo
    • Adding a filter in "Sync VSTS to GitHub"'s CI trigger to ignore commits from the service account running the build, or commits with a specific message keyword (e.g., [skip ci] in the commit message)

3. Validate how you're triggering "Proper Build"

If you're using a build completion trigger or API call to fire "Proper Build" from "Sync", make sure it's set up correctly:

  • For build completion triggers: Open "Proper Build"'s Triggers tab, go to Build completion, and confirm it only lists "Sync VSTS to GitHub" as the triggering build, with no extra branch/condition filters that could cause duplicates
  • If you're using a PowerShell script to call the VSTS API: Add debug logs to the script to confirm it only makes one API call, and check that the service account has the right permissions to avoid retries that might trigger a second build

4. Rule out reverse sync from GitHub to VSTS

If you have any setups that sync changes from GitHub back to VSTS (like webhooks or GitHub Actions), pushing from VSTS to GitHub will trigger that reverse sync, which then fires another CI build in VSTS.

  • Check your VSTS repo's Service Hooks to see if there's a webhook linked to GitHub
  • Check your GitHub repo's settings for any Actions or webhooks that push changes back to VSTS
  • Disable this reverse sync if it's unnecessary, or adjust the rules to skip syncing commits from your build service account

Go through these steps one by one, and you should track down why those two builds are firing every time you push.

内容的提问来源于stack exchange,提问作者Bartosz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:45:58