TeamCity,将一个构建步骤中生成的 id 传递给后面的构建步骤 [英] TeamCity, passing an id generated in one build step to a later build step

查看:25
本文介绍了TeamCity,将一个构建步骤中生成的 id 传递给后面的构建步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TeamCity 的新手.我有多个构建步骤.第 3 步生成第 4 步所需的 id.在第 3 步和第 4 步之间传递 id(字符串)的最佳方法是什么?构建步骤是用 Ruby 编写的.我可以设置环境变量吗?

New to TeamCity. I have multiple build steps. Step 3 generates an id that is needed in step 4. What is the best way to pass the id (a string) between step 3 and step 4? The build steps are written in Ruby. Can I set an environment variable?

推荐答案

是的,您可以在一个构建步骤中设置一个环境变量,并在接下来的步骤中使用它.您将需要在构建脚本中使用服务消息,如下所述 http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-AddingorChangingaBuildParameterfromaBuildStep 动态更新构建参数,您可以在下一步中使用.请注意,它不会在生成它的步骤中可用,只能在下一个步骤中使用.

Yes, you can set an environment variable in one build step and use it in the following step. You will need to use a service message in your build script as described here http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-AddingorChangingaBuildParameterfromaBuildStep to dynamically update a build parameter, which you can use in the next step. Note, that it won't be available in the step that generates it, only in the next one.

请注意,要设置变量,它必须以某种方式写出(echo 用于 bash 命令行,write-host 用于 Powershell),用引号括起来.示例:

Note that to set the variable, it must be written out somehow (echo for bash command-line, write-host for Powershell), in quotes. Example:

echo "##teamcity[setParameter name='env.ENV_AAA' value='aaaaaaaaaa']"

并使用此变量在下一个构建步骤的框中写入 %env.ENV_AAA%(至少在 TeamCity 9.1.7 中))

and to use this variable write %env.ENV_AAA% in the box in the next build step (Atleast in TeamCity 9.1.7))

这篇关于TeamCity,将一个构建步骤中生成的 id 传递给后面的构建步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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