简体   繁体   中英

Capistrano deployment from svn failing

I am trying to use capistrano 2 to deploy my app from subversion to a local server. Here is the code I am trying to deploy, it is just the default rails app:

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

Here is the my deploy.rb file which points to my svn repo:

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. However when I run cap deploy:cold and enter my username and password when prompted of my assembla account I get this error. 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:

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.

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. Try upgrading to the latest Capistrano and then if that doesn't fix the issue, file a GitHub issue on the Capistrano project.

Ryan Bigg is correct. There is a bug in the SVN authentication task that Capistrano uses to login to the remote SVN repository.

I'm running Capistrano version 2.15.6 and the path to the file in question is at

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. 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. Capistrano accepts SCM credentials so it doesn't need to prompt the user for them during deployments. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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