Using TeamCity in combiniation with git.
Currently, TeamCity is set up with "master
" as the default branch.
Typically, development takes place on another branch (e.g. "dev
") - TeamCity is set to watch for changes on "dev
" and build automatically.
If DEADBEEF-SOME-SHA
has been built & tagged by TeamCity as build 1.2.3.4 on "dev
" and we fast-forward merge that git SHA1 to "master
", TeamCity still performs a build - so we end up with DEADBEEF-SOME-SHA
being tagged as both 1.2.3.4 and 1.2.3.5.
As I understand it, making "dev
" the default branch would prevent this.
Is there another way to prevent TeamCity performing a build if a build has already succeeded for that same SHA1?
Note if we push directly to master
(and that SHA1 doesn't exist on other branches / hasn't been built) I'd still like to see a build.
I'd like to achieve this entirely in TeamCity if possible - no additional scripts/writing of files etc etc.
If you simply wish to restrict the branches for which builds are automatically triggered, set a branch filter for the VCS trigger:
Project settings => Triggers => VCS Trigger (edit) => Branch Filter
Set the branch filter to
+:dev
then (even though "master" is the default branch) builds will only be automatically triggered on dev. It is still possible to perform ad-hoc builds on other branches (assuming the VCS root allows it)
You can query builds for a particular SHA1... but you have to know your previous buildID for that.
So what I would do is:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With