John Hatton
John Hatton

Reputation: 1784

In TeamCity, is there a system/environment variable for the current build configuration id?

In TeamCity, if you know the build configuration id, then you can generate URLs like this:

http://example.org/guestAuth/repository/download/bt222/.lastSuccessful/exampleBuild.zip

But see that "bt222"? That's the Build Configuration ID; it is generated by TC when you set up the build configuration, and it's static. The Atlassian docs seem to say that the way to determine it is to look at your URL, on screen.

Thing is, I need to get at it programmatically, in the msbuild script, so that the same build script can serve multiple build configurations. TC otherwise has so many nice handy variables that I'm just hoping I've missed it somehow...

Upvotes: 6

Views: 4493

Answers (3)

knatten
knatten

Reputation: 5220

The configuration ID is available as %system.teamcity.buildType.id%.

Verified to work in Teamcity 7.1.5

Upvotes: 9

Niklas Wulff
Niklas Wulff

Reputation: 3524

It seems a bit shaky to rely on these ids, maybe you can approach it from another angle, and use Dependent builds and artefacts? Have you looked into that? We use that a lot to communicate files from one build configuration to another.

Upvotes: 0

Aleš Roubíček
Aleš Roubíček

Reputation: 5187

Make it as parameter to your build script and set it in build configuration settings from outside.

Build script should not depend on the build server, it should work locally as well.

Upvotes: 3

Related Questions