不同位置的相同标签名称会导致问题

发布于 2024-11-03 15:31:13 字数 798 浏览 3 评论 0原文

我正在使用 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 技术交流群。

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

发布评论

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

评论(2

衣神在巴黎 2024-11-10 15:31:13

您无法发布本地标签。这意味着您的第一步已经在 /my/web/directory 存储库中执行,或者已经有一个名为 revision 的 生产(您可以使用 <代码>hg 标签、hg 分支hg 书签)。

您有多种方法来修复您的工作流程(按优先顺序):

  • 使用通用前缀标签来区分不同的生产修订版,例如 product-23product-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 a production called revision there (you can check with hg tags, hg branches and hg bookmarks).

You have several ways to fix your workflow (in order of preference):

  • use common-prefixed tags to distinguish between different production revisions, like production-23 or production-42, which you can parse on the production box.
  • Create a production branch, where every revision to deliver is merged into this branch. I recommend this one if you already have experience with branches.
  • Use the bookmark extension, and create a 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 use hg 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.
  • Use regular tags to keep track of the production version. On the one hand it seems to be wrong to use tags for this kind of tracking, since tags are meant to be static. On the other hand you would have a track about which revisions where alive on some point in time. But the first solution does the tracking job much better.
浅浅淡淡 2024-11-10 15:31:13

可能很基本,但是您看到它确实做了什么吗?当您运行它时,可能什么也没有发生,部署的是您的“生产”标签。

由于 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.

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