Skip to content

rsync being run twice #16

Description

@fazy

Using capistrano 3.2.1 and capistrano-rsync 1.0.2, I managed to get a very basic example working, with a single Capfile like this.

However, if I try to make the directory structure used by Capistrano, I see the rsync command is run twice.

Here are my files:

./Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require "capistrano/rsync"

Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

./config/deploy.rb

set :application, "My Application"
set :repo_url, "git@bitbucket.org:XXX/XXX.git"
set :branch, "master"
set :deploy_to, "/var/www/test"
set :rsync_options, %w[--recursive --delete --delete-excluded  --exclude .git*]
set :scm, :rsync

namespace :rsync do
  task :set_current_revision do
    # nothing
  end
end

./config/deploy/dev.rb

server 'myserver', user: 'deploy', roles: %w{web}

(I added myserver to my hosts file for this example).

If I now run cap dev deploy, I get this output:

#!text
INFO[ee7cbc5d] Running /usr/bin/env mkdir -pv /var/www/test/shared /var/www/test/releases on myserver
DEBUG[ee7cbc5d] Command: /usr/bin/env mkdir -pv /var/www/test/shared /var/www/test/releases
INFO[ee7cbc5d] Finished in 0.152 seconds with exit status 0 (successful).
DEBUG[d2719cce] Running /usr/bin/env [ -f /var/www/test/current/REVISION ] on myserver
DEBUG[d2719cce] Command: [ -f /var/www/test/current/REVISION ]
DEBUG[d2719cce] Finished in 0.007 seconds with exit status 0 (successful).
DEBUG[73100218] Running /usr/bin/env cat /var/www/test/current/REVISION 2>/dev/null on myserver
DEBUG[73100218] Command: /usr/bin/env cat /var/www/test/current/REVISION 2>/dev/null
DEBUG[73100218]
DEBUG[73100218] Finished in 0.009 seconds with exit status 0 (successful).
HEAD is now at f3652d4 Merged in DEV-3008-support-release-version (pull request #3)
HEAD is now at f3652d4 Merged in DEV-3008-support-release-version (pull request #3)
skipping directory .
skipping directory .
INFO[c14f82bc] Running /usr/bin/env rsync --archive --acls --xattrs "/var/www/test/shared/deploy/" "/var/www/test/releases/20140609162536/" on myserver
DEBUG[c14f82bc] Command: rsync --archive --acls --xattrs "/var/www/test/shared/deploy/" "/var/www/test/releases/20140609162536/"
INFO[c14f82bc] Finished in 0.056 seconds with exit status 0 (successful).
INFO[7dd47543] Running /usr/bin/env rsync --archive --acls --xattrs "/var/www/test/shared/deploy/" "/var/www/test/releases/20140609162536/" on myserver
DEBUG[7dd47543] Command: rsync --archive --acls --xattrs "/var/www/test/shared/deploy/" "/var/www/test/releases/20140609162536/"
INFO[7dd47543] Finished in 0.052 seconds with exit status 0 (successful).
DEBUG[4c4ef630] Running /usr/bin/env if test ! -d /var/www/test/releases/20140609162536; then echo "Directory does not exist '/var/www/test/releases/20140609162536'" 1>&2; false; fi on myserver
DEBUG[4c4ef630] Command: if test ! -d /var/www/test/releases/20140609162536; then echo "Directory does not exist '/var/www/test/releases/20140609162536'" 1>&2; false; fi
DEBUG[4c4ef630] Finished in 0.007 seconds with exit status 0 (successful).
INFO[501e7e1b] Running /usr/bin/env echo "" >> REVISION on myserver
DEBUG[501e7e1b] Command: cd /var/www/test/releases/20140609162536 && /usr/bin/env echo "" >> REVISION
INFO[501e7e1b] Finished in 0.008 seconds with exit status 0 (successful).
INFO[7dcba5ac] Running /usr/bin/env rm -rf /var/www/test/current on myserver
DEBUG[7dcba5ac] Command: /usr/bin/env rm -rf /var/www/test/current
INFO[7dcba5ac] Finished in 0.008 seconds with exit status 0 (successful).
INFO[28029ffa] Running /usr/bin/env ln -s /var/www/test/releases/20140609162536 /var/www/test/current on myserver
DEBUG[28029ffa] Command: /usr/bin/env ln -s /var/www/test/releases/20140609162536 /var/www/test/current
INFO[28029ffa] Finished in 0.009 seconds with exit status 0 (successful).
DEBUG[fd3953a8] Running /usr/bin/env ls -x /var/www/test/releases on myserver
DEBUG[fd3953a8] Command: /usr/bin/env ls -x /var/www/test/releases
DEBUG[fd3953a8]         20140609161334  20140609161407  20140609161443  20140609161503  20140609162526
DEBUG[fd3953a8]         20140609162536
DEBUG[fd3953a8] Finished in 0.009 seconds with exit status 0 (successful).
INFOKeeping 5 of 6 deployed releases on myserver
INFO[301da6e1] Running /usr/bin/env rm -rf /var/www/test/releases/20140609161334 on myserver
DEBUG[301da6e1] Command: /usr/bin/env rm -rf /var/www/test/releases/20140609161334
INFO[301da6e1] Finished in 0.008 seconds with exit status 0 (successful).
DEBUG[c64fd4e6] Running /usr/bin/env if test ! -d /var/www/test/releases; then echo "Directory does not exist '/var/www/test/releases'" 1>&2; false; fi on myserver
DEBUG[c64fd4e6] Command: if test ! -d /var/www/test/releases; then echo "Directory does not exist '/var/www/test/releases'" 1>&2; false; fi
DEBUG[c64fd4e6] Finished in 0.005 seconds with exit status 0 (successful).
INFO[37a721d7] Running /usr/bin/env echo "Branch master (at ) deployed as release 20140609162536 by lars" >> /var/www/test/revisions.log on myserver
DEBUG[37a721d7] Command: echo "Branch master (at ) deployed as release 20140609162536 by lars" >> /var/www/test/revisions.log
INFO[37a721d7] Finished in 0.005 seconds with exit status 0 (successful).

So, why the duplicated git commands (HEAD is now at f3652d4 ...) and rsync commands (INFO[c14f82bc] Running /usr/bin/env rsync ...)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions