Question

I have two branches in git: master and "deploy" (not the real name but good for this example. When I want to deploy things to the test server, I merge those changes into deploy branch and I want TC to automatically deploy them. So I have a Build and a Deploy config set up in TeamCity. Build is set up to build all branches, so commits in both branches trigger builds. I want to set up the Deploy config to run only after a successful Build, and only if that Build was against the deploy branch. I see that I can set up a Snapshot Dependency, which seems like what I want, but I can't figure out how to limit it to only that branch. I want to guarantee that the Deploy build runs against the same source as the Build for the deploy branch.

No correct solution

OTHER TIPS

You can limit your builds to the deploy branch via the the VCS Root configuration screen.

  1. Clear the Default branch field.
  2. Add the refs/heads/deploy branch to the Branch specification field.

TeamCity branch specification

In order to integrate this change with a build template, you can parameterize the Branch specification as %git.branch.specification%.

  • For branch builds, the value is set to refs/heads/*
  • For deploy builds, the value is set to refs/heads/deploy
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top