3

Is there a way to retrieve comment message of teamcity build during its run.

From the wiki from Teamcity noticed there are ways to reach & retrieve server build / agent build properties : http://confluence.jetbrains.com/display/TCD7/Predefined+Build+Parameters

I would like to know, if there exists a solution to retrieve comment message string from the build. If few are present under pending changes, then it has to retrieve it with some line separator.

With system properties, if we define/add new property in the build in what format it gets retrieved when we somehow parse : teamcity.build.properties.file

Thanks,

user1587504
  • 764
  • 1
  • 10
  • 25
  • Is there any way of retrieving such comment message by parsing some tc-created file?. – user1587504 Jun 13 '13 at 13:20
  • Just to clarify, which specific comments are you looking for? It seems like you are asking for a comment associated with a source control revision but I just want to be sure. (I was just looking through the REST API and it doesn't look like it's available in a 7.1.4 installation at least.) – Nathan Stohlmann Aug 20 '13 at 18:05
  • Say, on any executed eg build if we go to 'Changes' tab, it shows on what set of changes it has run the build with. And if it has run : say on last 4 different commits, then there will be 4 different logger comment message listed in 'Changes' tab. Usually in normal scenario it just shows user specified comment-message during commit. We are following some standard pattern for specifying comment & I want to retrieve details & of that commit based on comment-string validation. – user1587504 Aug 21 '13 at 11:23
  • Possible duplicate of [Access to TeamCity build comments](http://stackoverflow.com/questions/10086235/access-to-teamcity-build-comments) – David Gardiner May 17 '16 at 01:29

1 Answers1

0

In order to retrieve comments of a build you can use 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
  • 1
    This is good however it would be very useful if the with.IncludeChanges(and => and.IncludeComments()) was available to the GetBuild() & GetBuilds() operations. – Observer Sep 26 '17 at 07:54
  • Please log an issue on FluentTc project: https://github.com/QualiSystems/FluentTc/issues – Boris Modylevsky Sep 26 '17 at 10:57
  • GetLastBuild by build Id is identical to GetBuild since there is only one build with the same Id. If you wish to see the IncludeChanges in GetBuilds, please open an issue – Boris Modylevsky Sep 26 '17 at 10:59