简体   繁体   English

SVN的Capistrano部署失败

[英]Capistrano deployment from svn failing

I am trying to use capistrano 2 to deploy my app from subversion to a local server. 我正在尝试使用capistrano 2将我的应用程序从Subversion部署到本地服务器。 Here is the code I am trying to deploy, it is just the default rails app: 这是我尝试部署的代码,它只是默认的Rails应用程序:

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

Here is the my deploy.rb file which points to my svn repo: 这是指向我的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

My cap deploy:setup works and creates the necessary folders. 我的帽子deploy:setup可以工作并创建必要的文件夹。 However when I run cap deploy:cold and enter my username and password when prompted of my assembla account I get this error. 但是,当我运行cap deploy:cold并在提示我的Assembla帐户时输入我的用户名和密码时,出现此错误。 Can anyone tell me why? 谁能告诉我为什么?

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:

--EDIT-- - 编辑 -

Tried changing to capistrano 2.12.0, it outputs different commands but I still get the same error: 尝试更改为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:

Thanks. 谢谢。

Looks like it's trying to authenticate as jack--password because there's no space here between the value of username and the --password option that follows it. 看起来它正在尝试通过jack--password进行身份验证,因为username的值与其后的--password选项之间没有空格。

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

I suspect it's a bug in whatever is executing that command, which might be a built-in to Capistrano. 我怀疑这是执行该命令的任何错误,这可能是Capistrano内置的。 Try upgrading to the latest Capistrano and then if that doesn't fix the issue, file a GitHub issue on the Capistrano project. 尝试升级到最新的Capistrano,然后仍不能解决问题,请在Capistrano项目上提交GitHub问题。

Ryan Bigg is correct. 瑞安·比格(Ryan Bigg)是对的。 There is a bug in the SVN authentication task that Capistrano uses to login to the remote SVN repository. SVN身份验证任务中有一个错误,Capistrano使用该错误登录到远程SVN存储库。

I'm running Capistrano version 2.15.6 and the path to the file in question is at 我正在运行Capistrano 2.15.6版,相关文件的路径为

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

Open this file for editing and look for the authentication definition block towards the bottom. 打开此文件进行编辑,然后在底部查找身份验证定义块。

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

Notice the lack of white space where --password and --no-auth-cache are being concatenated to the result variable. 注意,缺少--password和--no-auth-cache连接到结果变量的空白。 I simply added a space in here 我只是在这里添加了一个空间

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

It's possible that the OP isn't being prompted for SVN credentials when checking the repository out as they have saved the password against their SSH user. 签出存储库时,可能不会提示OP输入SVN凭据,因为他们已将密码保存为SSH用户。 Capistrano accepts SCM credentials so it doesn't need to prompt the user for them during deployments. Capistrano接受SCM凭据,因此在部署期间无需提示用户输入。 The reason why you're seeing a prompt to enter the details because with out the extra white space in the code above, it looks to the server as if Capistrano is trying to authenticate without sending a password. 之所以会提示您输入详细信息,是因为上面的代码中没有多余的空白,它看起来像是Capistrano尝试在不发送密码的情况下进行身份验证的服务器。

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

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