在 TeamCity 中从另一个构建中标记一个构建
我们有一个编译并创建工件的构建。然后我们有另一个构建,它使用最后一个编译构建并将其部署到正确的环境。完成后,我必须在 TC 中标记构建,将其推送到环境中。有没有一种方法可以标记使用部署构建部署的编译构建?
We have a Build that compiles and creates an artifact. Then we have another Build that uses the last Compile build and Deploys it to the proper environment. Once that is complete, I have to go and Tag the build in TC that it was pushed to the environment. Is there a way that I can tag the Compile Build that is was deployed using the Deploy Build?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道有什么简单的方法可以做到这一点(即通过 TeamCity 配置设置),但您可能可以使用 REST API 来自您的构建脚本。
I'm not aware of an easy way to do this (i.e. through a TeamCity configuration setting) but you probably could accomplish this using the REST API from your build script.
如果您使用的是 TeamCity 6 或更高版本,因为您有一个从部署构建到主构建的构建依赖链(通过工件依赖项、快照依赖项或两者),您只需标记您的部署构建即可。这是因为 UI 将向您显示部署使用的依赖项的树视图,并且您可以导航到实际构建。
您可以做的一件事(我认为应该做的一件事)是,如果您使用支持标记/标签的源代码控制,则从 TeamCity 标记您的源代码控制。您可能应该使用快照依赖项和工件依赖项来设置部署构建,特别是如果您的构建文件位于同一存储库中。在您的主构建中,您应该让 TeamCity 在成功构建时为您的存储库添加类似“build-1.2.3.4”的标签。然后,在您的部署构建中,您应该在成功构建后使用“deployed-1.2.3.4”标记存储库。如果您部署到不同的环境,那么您可以让它相应地标记存储库。
If you are using TeamCity 6 or above because you have a build dependency chain from the Deployment Build to the Main Build either through artifact dependencies, snapshot dependencies or both you can just tag your Deployment Build. This is because the UI will show you a tree view of the dependencies that the deployment used and you can navigate to the actual build.
One thing you can do, and in my opinion should do, is to tag your source control from TeamCity if you are using a source control that supports tagging/labelling. You should probably set your Deployment Build up with a snapshot dependency as well as the artifact dependency, especially if your build files are in the same repository. On your Main Build you should get TeamCity to label your repository on a successful build with something like "build-1.2.3.4". Then on your Deployment Build you should get it to label the repository after a successful build with "deployed-1.2.3.4". If you deploy to different environments then you can get it to label the repository accordingly.