【问题标题】:Calling a multistage capistrano task from within a capistrano task从 capistrano 任务中调用多阶段 capistrano 任务
【发布时间】:2011-03-24 09:12:52
【问题描述】:

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

例如:

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

这是从另一个上限任务调用多阶段任务的正确方法吗?

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

当这个任务运行时,它失败了:

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)

我正在从本地机器推送源,因为 git 存储库和部署机器无法相互通信。

【问题讨论】:

  • 现在是 100%。我一定是超级用户!

标签: ruby-on-rails deployment capistrano


【解决方案1】:

任务名称如

deploy:production:whatever

在 Cap 中暴露为

deploy.production.whatever

您还有 top 命名空间可以转到命名空间的顶部,因为路径是相对的。

因此,无论您当前的任务在哪个命名空间中,您都可以随时执行以下操作:

top.deploy.production.whatever

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-18
    • 2011-10-06
    • 2011-05-19
    • 1970-01-01
    • 1970-01-01
    • 2013-08-07
    • 2013-11-25
    相关资源
    最近更新 更多