不同位置的相同标签名称会导致问题
我正在使用 Mercurial 和 Fabric 来部署我的网站。我以前从未使用过 Fabric,因此我在线复制了一个示例 fab 文件,然后更改了 var 以匹配我自己的站点。
以下是代码行:
def prod():
env.hosts = ['kevinburke.webfactional.com']
env.user = 'kevinburke'
def deploy():
require('hosts' , provided_by=[prod])
local ("hg tag --local --force production")
local ("hg push --remotecmd /home/kburke/bin/hg") # this works fine
run ("cd /my/web/directory; hg update -C production")
这是从命令行调用的,因为
fab prod deploy
当我是部署该站点的唯一人时,这没有任何问题。但最近我添加了两个运行相同 fabfile 的提交者,当他们尝试部署站点时,站点的远程版本不会更新到最新版本 - 它仅更新到我标记为生产,而不是他们标记的那个。
我希望它会使用他们的“生产”标签来更新文件。为什么会出现这种情况?我怎样才能让程序在未来按照我的预期运行?
谢谢,凯文
I'm using Mercurial and Fabric to deploy my site. I'd never used Fabric before so I copied an example fab file online and then changed the vars to match my own site.
Here are the lines of code:
def prod():
env.hosts = ['kevinburke.webfactional.com']
env.user = 'kevinburke'
def deploy():
require('hosts' , provided_by=[prod])
local ("hg tag --local --force production")
local ("hg push --remotecmd /home/kburke/bin/hg") # this works fine
run ("cd /my/web/directory; hg update -C production")
and this is invoked from the command line as
fab prod deploy
When I was the only person deploying the site, this worked with no problems. But recently I added two committers who are running the same fabfile, and when they try deploying the site, the remote version of the site doesn't update to the latest version - it updates only to the latest version that I tagged as production, not the one that they tagged.
I expect that it would use their "production" tag to update the file. Why does this happen? How can I get the program to behave as I expect in the future?
Thanks, Kevin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法发布本地标签。这意味着您的第一步已经在
/my/web/directory
存储库中执行,或者已经有一个名为 revision 的生产
(您可以使用 <代码>hg 标签、hg 分支
和hg 书签
)。您有多种方法来修复您的工作流程(按优先顺序):
product-23
或product-42
,您可以在生产包装盒上对其进行解析。生产
分支,其中要交付的每个修订都将合并到该分支中。如果您已经有分支机构的经验,我推荐这个。生产
书签来跟踪您部署的版本。这看起来像是您当前想要建立的解决方案。当你想使用书签时,你需要在服务器和所有客户端上启用它们,并使用hg push -B Production
将书签的当前状态推送到服务器。此过程的一个缺点是您永远不会看到是否有人将其他书签推送到服务器,因为书签的传输会默默地重写服务器上的书签。You can't publish local tags. This means that either your first step is already performed in the
/my/web/directory
repo, or that there is already aproduction
called revision there (you can check withhg tags
,hg branches
andhg bookmarks
).You have several ways to fix your workflow (in order of preference):
production-23
orproduction-42
, which you can parse on the production box.production
branch, where every revision to deliver is merged into this branch. I recommend this one if you already have experience with branches.production
bookmark to keep track of your deployed version. This looks like the solution you currently want to establish. When you want to use bookmarks, you need to enable them both on the server and all clients, and usehg push -B production
to push the current state of your bookmark to the server. One disadvantage of this process is that you will never see if anyone had pushed an other bookmark to the server, since the transmission of the bookmark silently rewrites the bookmark on the server.可能很基本,但是您看到它确实做了什么吗?当您运行它时,可能什么也没有发生,部署的是您的“生产”标签。
由于
hg tag --local
意味着该标签仅适用于您的本地存储库并且没有版本控制,因此我想不出任何其他原因。其他人甚至无法知道该标签。May be basic, but did you see that it did indeed do anything? It might be that nothing happened and the deployed was your "production" tag when you had run it.
Since
hg tag --local
means the tag is only for your local repo and is not versioned, I cannot think of any other reason. Others won't even be able to know about the tag.