繁体   English   中英

SVN的Capistrano部署失败

[英]Capistrano deployment from svn failing

我正在尝试使用capistrano 2将我的应用程序从Subversion部署到本地服务器。 这是我尝试部署的代码,它只是默认的Rails应用程序:

https://www.assembla.com/code/capistranotest/subversion/nodes

这是指向我的svn存储库的my deploy.rb文件:

set :application, "CapistranoTest"
set :user, "jack"
set :repository,  "https://subversion.assembla.com/svn/capistranotest/"

set :scm, :subversion

set :deploy_to, "/home/jaeren/capistranotest"

role :web, "192.168.169.129"
role :app, "192.168.169.129"
role :db,  "192.168.169.129", :primary => true

set :scm_username, "jack"
set :runner, "jack"

set :use_sudo, false

我的帽子deploy:setup可以工作并创建必要的文件夹。 但是,当我运行cap deploy:cold并在提示我的Assembla帐户时输入我的用户名和密码时,出现此错误。 谁能告诉我为什么?

Jacks-MacBook-Pro:capistranotest Jack$ cd trunk
Jacks-MacBook-Pro:trunk Jack$ cap deploy:cold
  * 2015-04-27 00:31:45 executing `deploy:cold'
  * 2015-04-27 00:31:45 executing `deploy:update'
 ** transaction: start
  * 2015-04-27 00:31:45 executing `deploy:update_code'
    executing locally: "svn info https://subversion.assembla.com/svn/capistranotest/ --username \"jack\"--password \"\"--no-auth-cache  -rHEAD"
Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
Password for 'jack--password': *************************

Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
Username: jack
Password for 'jack': *************************

    command finished in 53369ms
  * executing "svn checkout -q --username \"jack\"--password \"\"--no-auth-cache  -r6 https://subversion.assembla.com/svn/capistranotest/ /home/jack/capistranotest/releases/20150426233238 && (echo 6 > /home/jack/capistranotest/releases/20150426233238/REVISION)"
    servers: ["192.168.169.129"]
    [192.168.169.129] executing command
 ** [192.168.169.129 :: err] Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
 ** [192.168.169.129 :: err] Password for 'jack--password':
Password: 
 ** [192.168.169.129 :: err] Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
 ** [192.168.169.129 :: err] Username:

- 编辑 -

尝试更改为capistrano 2.12.0,它输出不同的命令,但是我仍然遇到相同的错误:

Jaerens-MacBook-Pro:trunk Jaeren$ cap deploy:cold
  * executing `deploy:cold'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "svn info https://subversion.assembla.com/svn/capistranotest/ --username jaeren --password  --no-auth-cache  -rHEAD"
Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
Username: Jaeren
Password for 'Jaeren': ***********

    command finished in 8473ms
  * executing "svn checkout -q --username jaeren --password  --no-auth-cache  -r6 https://subversion.assembla.com/svn/capistranotest/ /home/jaeren/capistranotest/releases/20150427001157 && (echo 6 > /home/jaeren/capistranotest/releases/20150427001157/REVISION)"
    servers: ["192.168.169.129"]
    [192.168.169.129] executing command
 ** [192.168.169.129 :: err] Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
 ** [192.168.169.129 :: err] Username:

谢谢。

看起来它正在尝试通过jack--password进行身份验证,因为username的值与其后的--password选项之间没有空格。

executing locally: "svn info https://subversion.assembla.com/svn/capistranotest/ --username \"jack\"--password \"\"--no-auth-cache  -rHEAD"

我怀疑这是执行该命令的任何错误,这可能是Capistrano内置的。 尝试升级到最新的Capistrano,然后仍不能解决问题,请在Capistrano项目上提交GitHub问题。

瑞安·比格(Ryan Bigg)是对的。 SVN身份验证任务中有一个错误,Capistrano使用该错误登录到远程SVN存储库。

我正在运行Capistrano 2.15.6版,相关文件的路径为

capistrano-YOURVERSION/lib/capistrano/recipes/deploy/scm/subversion.rb

打开此文件进行编辑,然后在底部查找身份验证定义块。

def authentication
    username = variable(:scm_username)
    return "" unless username
    result = %(--username "#{variable(:scm_username)}")
    result << %(--password "#{variable(:scm_password)}") unless variable(:scm_auth_cache) || variable(:scm_prefer_prompt)
    result << "--no-auth-cache " unless variable(:scm_auth_cache)
    result
end

注意,缺少--password和--no-auth-cache连接到结果变量的空白。 我只是在这里添加了一个空间

def authentication
    username = variable(:scm_username)
    return "" unless username
    result = %(--username "#{variable(:scm_username)}")
    result << %( --password "#{variable(:scm_password)}") unless variable(:scm_auth_cache) || variable(:scm_prefer_prompt)
    result << " --no-auth-cache " unless variable(:scm_auth_cache)
    result
end

签出存储库时,可能不会提示OP输入SVN凭据,因为他们已将密码保存为SSH用户。 Capistrano接受SCM凭据,因此在部署期间无需提示用户输入。 之所以会提示您输入详细信息,是因为上面的代码中没有多余的空白,它看起来像是Capistrano尝试在不发送密码的情况下进行身份验证的服务器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM