从一个capistrano任务中调用多级capistrano任务

编程入门 行业动态 更新时间:2024-10-25 00:28:15
本文介绍了从一个capistrano任务中调用多级capistrano任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个capistrano任务来整合Rails项目的多个阶段的部署。

例如:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ # b staging deploy.migrations production deploy.migrations end

这是从另一个帽子任务调用多级任务的正确方法?

构建任务创建一个新的git分支并发布。新分支的名称被保存为capistrano变量。分段和生产阶段任务然后使用此变量指定要部署的分支。

当此任务运行时,它将失败:

致命:工作树'/ Users /<我的工作目录>'已经存在。 /usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/recipes/deploy/strategy/copy.rb:99:in`initialize':没有这样的文件或目录 - / var / folders / 3d / 3dKYNUwQGOSLZFXsMF-uv ++++ TM / -Tmp- / 20100802182750 / REVISION(Errno :: ENOENT)

我将本地机器的源代码作为git仓库和部署机器无法相互通信。

解决方案

任务名称如

deploy:production:whatever

在Cap中显示为

部署production.whatever

您还有 top 命名空间去命名空间的顶部,因为这些路径是相对的。

所以,无论你目前的任务是什么命名空间,你总是可以像th

top.deploy.production.whatever

I have a capistrano task that consolidates the deployment of multiple stages of a Rails project.

For example:

task :consolidated_task do build #creates a new release branch from master, #sets a variable with the relese branch name staging deploy.migrations production deploy.migrations end

Is this the proper way to call a multistage task from another cap task?

The build task creates a new git branch and published it. The name of the new branch gets saved as a capistrano variable. the staging and production stage tasks then use this variable to specify what branch to deploy from.

When this task runs, it fails with:

fatal: working tree '/Users/<my working directory>' already exists. /usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/recipes/deploy/strategy/copy.rb:99:in `initialize': No such file or directory - /var/folders/3d/3dKYNUwQGOSLZFXsMF-uv++++TM/-Tmp-/20100802182750/REVISION (Errno::ENOENT)

I'm pushing the source from my local machine as the git repository and the deployment machine cannot communicate with each other.

解决方案

Task names like

deploy:production:whatever

are exposed within Cap as

deploy.production.whatever

You also have top namespaces to go to the top of the namespaces, because the paths are relative.

So, no matter in which namespace your task currently is you can always do thigs like:

top.deploy.production.whatever

更多推荐

从一个capistrano任务中调用多级capistrano任务

本文发布于:2023-11-24 05:35:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624121.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:capistrano

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!