文件内容替换器对工件没有影响 [英] File Content Replacer having no effect on artifacts

查看:136
本文介绍了文件内容替换器对工件没有影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TeamCity的一项相对较新的功能:文件内容替换器.在我当前的设置中,我的VCS中有一个version.js文件:

I'm using a relatively new feature of TeamCity: File Content Replacer. In my current setup I have a version.js file in my VCS:

window["MyPlugin"].version = "1.0.##VCS_REVISION##.##CI_BUILD_NUMBER##";

我使用文件内容替换器构建功能将最后一部分替换为:

I use the File Content Replacer build feature to replace that last part with:

%build.vcs.number%.%system.build.number%

到目前为止一切顺利!

我有一个相关的构建步骤.这是一个MSBuild步骤,但是除了调用ps1以外,它什么都不做,它执行两项相关的操作:

I have one relevant build step. It's an MSBuild step, but it does nothing except call a ps1, which does two relevant things:

  1. 将所有js文件移动到"output"文件夹;
  2. 将所有js文件压缩到"zips"文件夹中;
  1. Moves all js files to an "output" folder;
  2. Zips all js files into a "zips" folder;

这也是我的两个工件(一个输出文件夹和一个zip文件).

Those are also my two artifacts (an output folder, and a zip file).

但是,文件内容替换器还原其更改,但是此还原也反映在工件nr 1中,这些工件是不受版本控制的文件(即使它们位于我的项目文件夹的子文件夹中). zip文件中的version.js文件未还原.

However, the File Content Replacer reverts its changes, but this revert is also reflected in artifact nr 1, which are files that are not under version control (even though they are located as a subfolder of my project folder). The version.js file in the zip file is not reverted.

如果将工件1更改为my/output/folder => all.%build.vcs.number%.zip,则该zip文件还将包含一个还原的状态,而不是我想要的输出.

If I change artifact 1 to be my/output/folder => all.%build.vcs.number%.zip then the zip file will also contain a reverted state instead of the output I want.

如何设置TeamCity,以使工件文件不受此还原的影响?还是我需要除此构建功能以外的其他功能?

How do I set TeamCity up so that the artifact files are not affected by this revert? Or do I need something other than this Build Feature?

我将Windows 2012 Server(VM)和默认数据库上运行的TeamCity 9.1.3内部版本37176用于评估目的.我正在使用TFS 2013作为我的VCS.

I'm using TeamCity 9.1.3 build 37176 running on Windows 2012 Server (VM) and the default database for evaluation purposes. I'm using TFS 2013 as my VCS.

PS.我还在JetBrains论坛上问过 .

PS. I've also asked about this on the JetBrains forums.

推荐答案

文件内容替换将还原发布工件"阶段之前的更改.这是设计使然".您可以在构建日志中检查它.但是,您可以在隐藏的工件.teamcity/JetBrains.FileContentReplacer/中找到修改的文件.
如果要将更改的文件发布为常规工件,则应创建文件的副本(或像已经完成的那样打包/存档).另外,除了使用File Content Replacer构建功能之外,您还可以创建一个脚本,该脚本将进行不还原的所需更改.

File content replace reverts changes before "Publishing artifacts" stage. This is "by design". You can check it in the build log. However you can find modified files in hidden artifacts .teamcity/JetBrains.FileContentReplacer/.
If you want to publish changed file as regular artifact you should create a copy of the file (or pack/archive it as as you've already done). Also instead of using File Content Replacer build feature you can create a script that would make needed changes which aren't reverted.

这篇关于文件内容替换器对工件没有影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆