Why did my TeamCity build stop working?
Asked Answered
F

1

36

I have a TeamCity build configuration that has been working fine until recently. Suddenly, there is a build stuck in the queue that says it is not compatible with any agents. The reason given is:

Implicit requirements: teamcity.build.branch defined in Parameter: BuildFormatSpecification

My BuildFormatSpecification parameter is defined thus:

%MajorVersion%.%MinorVersion%.%PatchVersion%-%teamcity.build.branch%

That in turn is used in the Build Number Format field along with a build counter, like this:

%BuildFormatSpecification%.%sharedBuildNumber.id4%

The idea is that the build number comes out like "1.0.0-develop.22" and includes the Git branch being built. This follows the rules for Semantic Versioning. This scheme has worked for me over a number of projects, but suddenly this one build is stuck and I can't figure out why.

Any ideas?

Feel answered 11/3, 2014 at 0:39 Comment(1)
I had this error when my VSC root path ("Pull changes From") pointed to a physical directory instead of an URL. This worked on one agent, where the physical path was valid. All other agents did not have a repository at that path. After removing the only working agent, other agents were not able to ckeckout sources, resulting in %teamcity.build.branch% not being defined. The solution was to change the path to a globally accessible URL of the repository.Densitometer
C
65

teamcity.build.branch is a predefined build parameter but it is only defined when a branch specification is configured. Therefore, to fix your problem, make sure that your build has a VCS root configured and add e.g. +:refs/heads/(master) as the VCS root's branch specification.

From TeamCity's documentation on Agent Requirements and implicit requirements:

Any reference (name in %-signs) to an unknown parameter is considered an "implicit requirement". That means that the build will only run on the agent which provides the parameters named.

Otherwise, the parameter should be made available for the build configuration by defining it on the build configuration or project levels.

Coomb answered 7/1, 2015 at 22:9 Comment(3)
Also, Team City doesn't clear the problem once you fix it, you have to delete the build request and re-add it back. Nice. At least, on the version I'm using, which is a few builds back. Ironically, if you set a default branch (required), and then leave the branch specification blank (shouldn't be required, as their description of it is: "Branches to monitor besides the default one " - which is 'none' just monitor the default one. Also, if you switch from a single line here, to two full specifications, your branch displayed changes from 'develop' to /ref/head/develop' whichHectogram
wastes space on the description,and adds junk to the build name - and was causing my builds to fail due to the name... No clue how to fix that..Hectogram
You should ask a new question about branch names but the answer is to use parentheses around the part you want to be displayed, in my example it will be "master". See jetbrains.com/help/teamcity/….Coomb

© 2022 - 2024 — McMap. All rights reserved.