Teamcity 工件到 SVN
我们固定了部署到生产环境的构建。 是否有一种简单、自动化的方法将固定构建的工件上传到 svn 存储库?
We pinned builds that get deployd to production.
Is there an easy, automated way to upload the artifacts of pinned builds to a svn repository?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
注意:版本控制工件似乎不是一个好的做法。如果您的源代码由 VCS 管理,您就可以根据过去的修订版本以任何先前状态重建系统。此外,出于实际原因,TeamCity 已经保留了您的工件的最新历史记录,因此您可以快速访问它们\部署它们。
回到您的问题:我看不出有什么好的方法来实现您的要求。不过有两个想法:
从构建脚本将工件推送到 SVN 存储库非常简单;您只需要创建一个将文件提交到您的存储库的任务。如果在此阶段您有足够的上下文来知道是否必须固定构建,则可以触发提交。
TeamCity 提供了一个很好的 REST API。从任何自动化作业/脚本/程序中,您可以查询构建服务器以获取“任何版本的引脚状态”:
<块引用>
获取当前引脚状态:GET
http://teamcity:8111/httpAuth/app/rest/builds//pin/
(返回“true”或“false”文本)
一旦获得构建状态,您就可以下载并提交您的工件。
再次,整个过程对我来说似乎很尴尬。
Note : Versionning artifacts doesn't seem to be a good practice. If your source is managed by a VCS, you're already able to rebuild your system at any previous state, from past revisions. Moreover, for practical reasons, TeamCity already keeps a recent history of your artifacts, so you can access them\deploy them quickly.
Back to your question : I can't see any good way to achieve what your asking for. Two ideas though:
Pushing artifacts to your SVN repo is quite straightforward from your build script ; you just need to create a task that commit files to your repo. If at this stage you have enough context to know if the build must be pinned, you can trigger the commit.
TeamCity offers a nice REST API. From any automated job/script/program, you can query your build server to get the "pin status" of any build:
Once you get the status of the build, you can download and commit your artifacts.
Again, the whole process seems awkward to me.
TeamCity 充当 Ivy 存储库。因此,将东西放入 SVN 的需求有点不那么有吸引力。您只需备份它,然后您的构建脚本就可以将其用作存储库。
或者,您可以创建一个构建配置,其中的工件依赖于项目的“最后固定”构建。
您可以在构建时触发它,或者作为构建的依赖项,您可以只使用计时器。
您可以让它运行执行 SVN 上传的 Ant 脚本。 ,您可能需要通过构建脚本进行检查,看看这是新的固定构建还是旧的构建。
TeamCity acts as an Ivy repository. So, the need to put things into SVN is somewhat less attractive. You just back it up and you have your build script use it as a repository.
Alternatively you can create a build configuration with an artifact dependency on the "last pinned" build of your project.
You can either trigger it AS your build, or as a dependency of your build, you can just use a timer.
You can make it run an Ant script that does the SVN uploading. , you may need to check via your build script to see if this is a new pinned build or an old one.