使用变量在 Team City 中定义 VCS 根 URL

发布于 2024-08-19 16:16:16 字数 345 浏览 5 评论 0原文

我们正在尝试为发布标签定义 TeamCity 项目。当我们准备好发布时,我们使用包含版本号的标签来标记主干。我们希望构建过程基于此标签进行签出,并且当构建完成时,将文件移动到一个名称也基于版本号的文件夹中。

我们只对拥有“最新版本”项目感兴趣,因此每次迁移到新版本时,我们都会使用新版本号重新配置现有的 TC 项目。

我遇到的问题是参数化 VCS 根 url (SVN)。我知道如何为构建设置可在构建过程中使用的变量,我们可以使用这些变量来配置将文件移动到的文件夹。但是,我似乎找不到创建可以在 SVN url 中引用的变量的方法。

有没有办法从变量中获取 VCS url?是否可以在 VCS 根目录和项目配置之间共享一个变量?

We're trying to define a TeamCity project for a release tag. When we're ready to release, we tag trunk with a tag that includes the version number. We want the build process to checkout based on this tag and when the build is complete, move the files into a folder with a name that is also based on the version number.

We're only interested in having a "latest version" project, so each time we move to a new version, we will reconfigure the existing TC project with the new version number.

The problem I'm having is in parameterising the VCS root url (SVN). I know how to set up variables for the build that can be used in the build processes, which we could use to configure the folder we move the files to. However, I can't seem to find a way to create a variable that we can reference in the SVN url.

Is there a way to derive VCS urls from variables? Is it possible to have one variable shared between the VCS root and the project configuration?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

吖咩 2024-08-26 16:16:16

从版本 6.5 开始,TeamCity 允许在 VCS 设置中使用参数: 参数化版本控制系统根

Starting from version 6.5, TeamCity allows to use parameters in VCS settings: Parameterized Version Control System roots

静水深流 2024-08-26 16:16:16

我认为 Team City 不支持这一点,据我尝试时发现,您不能在 VCS 设置中使用变量。为了解决这个问题,我做了一个父模板,它定义了根 VCS 源,在我的例子中是 SVN,每个构建配置都是根据该模板构建的,然后您可以在您正在使用的 VSC 名称右侧定义签出规则对于“版本控制设置”选项卡上给定的构建配置,并在那里使用变量。因此,我可以让所有构建配置共享公共 SVN 根并从那里定义细节。您可以将此变量设置为每个构建配置的静态固定设置,方法是使其成为“属性和环境变量”屏幕中的配置变量,或者使其在同一屏幕中作为用户参数但作为系统或环境变量构建运行。希望这有帮助。

I don't think Team City supports this, you can't use variables within the VCS settings as far as I have found when I tried. What I did to get around this was I have a parent template that defines a root VCS source, SVN in my case, each build configuration is built off this template then you can define checkout rules to the right of the VSC name you're using for a given build config on the 'Version Control Settings' tab and use variables there. So I can have all build configurations share the common SVN root and define specifics from there. You can make this variable a static fixed setting per build configuration by making it a configuration variable in the 'Properties and Environment Variables' screen or making it build run specific as a user parameter in the same screen but as a System or Environment variable. Hope this helps.

辞慾 2024-08-26 16:16:16

我不确定我完全理解你的要求,所以我会尝试逐点回答这个问题:

问:“我们希望构建过程基于此标签进行签出,当构建完成时,将文件移入一个文件夹,其名称也基于版本号。”

答:如果您尝试动态更改 vcs 根目录,那么我认为这是不可能的。

问:“我遇到的问题是参数化 VCS 根 url (SVN)”

答:以下是一些可能有帮助的变量:

%dep.btXX.vcsroot.{svn_branch}.client-mapping% - 这将显示什么vcs 根视图。您只需设置正确的项目代码即可。
%dep.btXX.env.BUILD_VCS_NUMBER% - 附加到构建配置的第一个 VCS 根的 VCS 修订号。

我希望这会有所帮助..但听起来你的设置确实过于复杂。如果您为我列出步骤,我也许可以给您更好的答案。

I'm not sure I completely understand what you are asking for, so I will try to answer this point by point:

Q: "We want the build process to checkout based on this tag and when the build is complete, move the files into a folder with a name that is also based on the version number."

A: If you are trying to dynamically change the vcs root then I don't believe this is possible.

Q: "he problem I'm having is in parameterising the VCS root url (SVN)"

A: Here are some variables that might help:

%dep.btXX.vcsroot.{svn_branch}.client-mapping% - this will show what the vcs root views. You just need to set the correct project code.
%dep.btXX.env.BUILD_VCS_NUMBER% - VCS revision number of the first VCS root attached to the build configuration.

I hope this helps.. But it does sound like you have an overcomplicated setup. If you bullet the steps for me, I might be able to give you a better answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文