Using a variable to define a VCS root URL in Team City
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?
Starting from version 6.5, TeamCity allows to use parameters in VCS settings: Parameterized Version Control System roots
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.
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.
精彩评论