【问题标题】:Access to TeamCity build comments访问 TeamCity 构建评论
【发布时间】:2017-08-29 11:49:58
【问题描述】:

继续回答这个问题: Is it possible to add a free text note to a team city build?

在 TeamCity 自定义构建对话框中,有一个“构建 cmets”字段。

有没有办法从构建中访问它? 作为系统属性还是环境变量?

【问题讨论】:

    标签: teamcity


    【解决方案1】:

    据我所知,构建注释不会从您的构建脚本中公开或访问,但是您可以创建可访问的自定义构建参数。您可以创建系统属性或环境变量,它们都可以在您的构建脚本中访问。详情请参阅TeamCity docs on custom parameters

    【讨论】:

      【解决方案2】:

      也许这个问题已经过时了,但我会回答以防万一其他人感兴趣。

      可以使用 TeamCity REST API 检索评论:

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

      如果您在 C# 项目中需要它,您可以考虑使用 FluentTc 库:

      IBuild build = new RemoteTc()
         .Connect(_ => _.ToHost("teamcity.codebetter.com").AsGuest())
         .GetLastBuild(
             having => having.Id(216886),
             with => with.IncludeChanges(and => and.IncludeComment()));
      

      【讨论】:

        【解决方案3】:

        一种实现方式如下:

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

        这将返回带有构建参数的 xml,cmets 将是子节点之一。

        【讨论】:

          猜你喜欢
          • 2017-02-12
          • 1970-01-01
          • 2015-01-27
          • 2021-02-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多