Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过github webhook执行capistrano部署shell脚本时失败_Shell_Github_Capistrano_Webhooks_Continuous Deployment - Fatal编程技术网

通过github webhook执行capistrano部署shell脚本时失败

通过github webhook执行capistrano部署shell脚本时失败,shell,github,capistrano,webhooks,continuous-deployment,Shell,Github,Capistrano,Webhooks,Continuous Deployment,我正在尝试使用github webhooks和capistrano实现一个连续部署例程 我的计划是将capistrano-rake任务放在shell脚本中,并从另一个rails项目(github webhook)中的控制器操作调用它 下面是shell脚本(wallet\u deploy.sh) 这是日志 /home/deploy/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/rubygems_i

我正在尝试使用github webhooks和capistrano实现一个连续部署例程

我的计划是将capistrano-rake任务放在shell脚本中,并从另一个rails项目(github webhook)中的控制器操作调用它

下面是shell脚本(wallet\u deploy.sh)

这是日志

/home/deploy/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:304:in `block in replace_gem': capistrano is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from /home/deploy/.rbenv/versions/2.2.4/bin/cap:22:in `<main>'
当我在shell中手动执行Cap部署时,它可以完美地工作

deploy@ubuntu14-public:~/apps/ci/current$ ./wallet_deploy.sh

不确定我做错了什么,是否有不同的方法来实现这一点

正在侦听webhook的Rails应用程序已经有了自己的捆绑程序环境。当您尝试使用
系统
向脚本推出时,脚本将继承当前绑定器环境。这可能就是为什么会出现“capistrano不是捆绑包的一部分”错误的原因

要确保脚本使用新的捆绑程序环境,请尝试以下操作:

Bundler.with_clean_env do
  system("./wallet_deploy.sh")
end
从Bundler的
bundle exec

任何打开子shell(如system、backticks或%x{})的Ruby代码都将自动使用当前的Bundler环境。如果需要使用不属于当前捆绑包的Ruby命令,请使用带有块的with_clean_env方法

以及:

如果您要使用不同的捆绑包,那么与_clean_env一起使用也是必要的。在子shell中运行的任何Bundler命令都将继承当前的Gemfile,因此需要在不同bundle的上下文中运行的命令也需要与_clean_env一起使用


正在侦听webhook的Rails应用程序已经有了自己的捆绑程序环境。当您尝试使用
系统
向脚本推出时,脚本将继承当前绑定器环境。这可能就是为什么会出现“capistrano不是捆绑包的一部分”错误的原因

要确保脚本使用新的捆绑程序环境,请尝试以下操作:

Bundler.with_clean_env do
  system("./wallet_deploy.sh")
end
从Bundler的
bundle exec

任何打开子shell(如system、backticks或%x{})的Ruby代码都将自动使用当前的Bundler环境。如果需要使用不属于当前捆绑包的Ruby命令,请使用带有块的with_clean_env方法

以及:

如果您要使用不同的捆绑包,那么与_clean_env一起使用也是必要的。在子shell中运行的任何Bundler命令都将继承当前的Gemfile,因此需要在不同bundle的上下文中运行的命令也需要与_clean_env一起使用

Bundler.with_clean_env do
  system("./wallet_deploy.sh")
end