Skip to content

Commit

Permalink
Cleanup fails to cd releases_path
Browse files Browse the repository at this point in the history
For some strange reason having cleanup cd to deploy_to and then releases_path makes the deploy fail: it can't find the releases_path directory.

-----> Cleaning up old releases (keeping 3)
       $ cd "/exordo-dev/instances/d0000052" || exit 15
       $ cd "releases" || exit 16
 !     ERROR: Deploy failed.

When cd is combined in one command it just works fine:

-----> Cleaning up old releases (keeping 3)
       $ cd "/exordo-dev/instances/d0000052/releases" || exit 15
       $ count=0
       $ remove=0
       $ ls -1d [0-9]* | sort -rn | tail -n  | xargs rm -rf {}

-----> Build finished

In this case, deploy:cleanup is called at the end of the deploy task.

Am I doing something wrong or is it a bug?
  • Loading branch information
Darío Javier Cravero committed Aug 12, 2012
1 parent 54862bd commit 7cb8b87
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/mina/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
All other deployed revisions are removed from the servers."
task :cleanup do
queue %{echo "-----> Cleaning up old releases (keeping #{keep_releases!})"}
queue echo_cmd %{cd "#{deploy_to!}" || exit 15}
queue echo_cmd %{cd "#{releases_path!}" || exit 16}
queue echo_cmd %{cd "#{deploy_to!}/#{releases_path!}" || exit 15}
queue echo_cmd %{count=`ls -1d [0-9]* | sort -rn | wc -l`}
queue echo_cmd %{remove=$((count > 5 ? count - #{keep_releases} : 0))}
queue echo_cmd %{ls -1d [0-9]* | sort -rn | tail -n $remove | xargs rm -rf {}}
Expand Down

0 comments on commit 7cb8b87

Please sign in to comment.