Access to TeamCity build comments

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 11:58:11

问题


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?


回答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.




回答2:


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()));



回答3:


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.



来源:https://stackoverflow.com/questions/10086235/access-to-teamcity-build-comments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!