How can I access the value of the build comment from within the build?

When the user launches a build manually they have the option to key in a "build comment".  Can I get access to this comment from within my build?  

I was hoping to see some sort of %build.Comment% variable listed in the properties chooser dialog, but unfortunately it is not there.  That would be my preferred solution.  But if that is not possible, is this information available via the REST api?


Build's comment is availalbe via REST when you request a build.

BTW, if you need to pass some value into the build it seems more appropriate to add/modify a system property in run custom build dialog. And the property can be easy available in the build.



What I am doing is I have a special build config just for copying artifacts to a UNC share for our QA folks to pick up.  I also want to update a Sharepoint page with the build number and the comment.  


Thank you for the details. I see the point.

I am not sure it's a good idea to add a property with a comment to every build. Luckily enough, you can write a very simple TeamCity plugin to do the task.
If you choose to go this route, you can grab GroovyPlug and get the feature with a single line in GroovyPropertiesProvider.groovy.

The line could look like:

public Map<String, String> getParameters(@NotNull final SBuild build, final boolean emulationMode) {
     if (build.getBuildComment() != null) parameters.addEnvAndSystem("build.comment", build.getBuildComment().getComment());


Message was edited by: Yegor Yarko


Could you give me a hint how  can I get the comment to the currently running build?

I try this way: http://myteamcity/httpAuth/app/rest/builds/?locator=running:true,buildTypeId:bt3 and it shows me details of currently running build that I am interested in but I do not see any comment.

What I want to do is to send email that will contain a comment after the build finishes.
Could you help me with this?



Do you need VCS commit messages or build comments within TeamCity?


I'd use URL like
where you can get <internal_build_id> from configuration paramter.

The response shoul dhave "comment" element.

> What I want to do is to send email that will contain a comment after the build finishes.
If this email is ment for users of TeamCity, you can consider customizing notificaiton template to include whatever information you need.


Please sign in to leave a comment.