4

A continuation on the answer to this question: Is it possible to add a free text note to a team city build?

In TeamCity custom build dialog there is a field for "Build comments".

Is there a way to access this from within the build? Either as a system property or environment variable?

Community
  • 1
  • 1
sbhl
  • 433
  • 1
  • 4
  • 9

3 Answers3

2

One way of achieving it is as follows:

http://[host]:[port]/httpAuth/app/rest/builds/id:<internal build id>

This will return xml with build Parameters, comments will be one of child nodes.

Dmitry Matveev
  • 5,320
  • 1
  • 32
  • 43
1

As far as I know, the Build Comments are not exposed or accessible from your build script, however you can create custom build parameters that are accessible. You can create system properties or environment variables, either of which can be accessed in your build script. See the TeamCity docs on custom parameters for full details.

Jeff French
  • 1,029
  • 8
  • 22
1

Maybe this question is outdated, but I'll answer just in case somebody else is interested.

Comments can be retrieved using TeamCity REST API:

http://teamcity.codebetter.com/guestAuth/app/rest/changes?locator=build:id:216886&fields=change(id,version,href,username,date,webUrl,comment)

If you need it from C# project, you may consider using FluentTc library:

IBuild build = new RemoteTc()
   .Connect(_ => _.ToHost("teamcity.codebetter.com").AsGuest())
   .GetLastBuild(
       having => having.Id(216886),
       with => with.IncludeChanges(and => and.IncludeComment()));
Boris Modylevsky
  • 3,029
  • 1
  • 26
  • 42