TeamCity REST API:使用自定义工件依赖项触发构建

1 teamcity

我正在尝试使用 TeamCity 8.1 REST API 触发自定义构建(请参阅https://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-TriggeringaBuild)。我的构建运行良好,并且可以毫无问题地指定自定义分支和属性。我现在的目标是为我正在触发的构建指定自定义工件依赖项。

创建构建时收到的响应如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  <build taskId="1234" buildTypeId="buildConfig1" state="queued" ...>
  <buildType id="buildConfig1" name="Build Config Name"  ... />
  ...
  <properties count="1">
    <property name="testParam" value="Test 123" own="true" />
  </properties>
  <custom-artifact-dependencies />
</build>
Run Code Online (Sandbox Code Playgroud)

此响应中的“custom-artifact-dependencies”标签让我相信有一种方法可以指定自定义依赖项,但我没有在 TeamCity 文档、TeamCity 论坛或 Google 中找到任何内容来解释如何实现这一点。有什么我在这里忽略的东西或其他实现此目的的方法吗?


将以下内容添加到“build”标签的子级会导致“Artifact dependency should have type 'artifact_dependency'”。错误:

<custom-artifact-dependencies>
 <artifact-dependency buildId="5432" buildTypeId="parentBuildConfig"/>
</custom-artifact-dependencies>
Run Code Online (Sandbox Code Playgroud)

服务器可能会混淆我的意图与用于设置和查看工件依赖项的构建配置 API(例如http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/artifact-dependency/

小智 5

我遇到了同样的问题这对我有用:

    <build>
      <triggeringOptions queueAtTop="true"/>
      <buildType id="buildConfig1"/>
      <custom-artifact-dependencies count="1">
       <artifact-dependency id="0" type="artifact_dependency">
        <properties>
         <property name="pathRules" value="Artifacts_1.zip
Artifacts_2.zip
Artifacts_To_Unzip.zip!/**
"/>
         <property name="cleanDestinationDirectory" value="true"/>
         <property name="revisionName" value="buildId"/>
         <property name="revisionValue" value="5432"/>
        </properties>
        <source-buildType id="parentBuildConfig" />
       </artifact-dependency>
      </custom-artifact-dependencies>
    </build>
Run Code Online (Sandbox Code Playgroud)

如果“parentBuildConfig”构建仍在运行,请将 buildId 参数替换为 taskId