在特定构建步骤后发布工件

问题描述:

我通过 3 个步骤在 TeamCity 中设置了构建配置:

I've setup build configuration in TeamCity with 3 steps:

  • 构建解决方案
  • 进行单元测试
  • 将工件上传到 FTP

对于 FTP 上传,我使用了来自 http://teamcityrunners.codeplex.com/ 的 FTPUpload 插件.要上传的文件夹设置为绝对路径:

For FTP uploading I've used FTPUpload plugin, taken from http://teamcityrunners.codeplex.com/. Folder to upload was set to absolute path:

%userprofile%\.BuildServer\system\artifacts\%env.TEAMCITY_PROJECT_NAME%\%env.TEAMCITY_BUILDCONF_NAME%\%env.BUILD_NUMBER%\

根据构建日志,只有在所有步骤都完成后才会发布工件.

According to build log, artifacts publishing take place only after all steps have been completed.

是否可以将 TeamCity 配置为在特定构建步骤后发布工件?

Is it possible to configure TeamCity to publish artifacts after certain build step?

我们为我的一个项目做了类似的事情.我们使用 2 种构建配置.

We do something similar for one of my projects. We use 2 build configurations.

第一个构建解决方案,运行单元测试并生成工件.

The first one builds the solution, runs unit tests and produces the artifacts.

第二个构建是使用 Artifact Dependency 在最后一个成功的基础上设置的建造.这意味着第二个构建将开始从第一个构建中获取工件.第二个构建将有一个上传到 ftp 站点的构建步骤.第二个构建是使用 Finish Build Trigger 设置的,指向第一个构建.这将使其在第一个构建完成时启动.

The second build is set up with an Artifact Dependency on the last successful build. That means the second build will start out grabbing the artifacts from the first build. The second build would have a build step that uploads to the ftp site. The second build is setup with a Finish Build Trigger pointing to the first build. That will make it kick off whenever the first build finishes.

这种方式需要更多的工作,但是一旦您设置好它,它就可以很好地工作.

It's a bit more work this way, but once you have it setup it works pretty well.