Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Change ls options to '-xr' to stop nondeterministic deploy:rollback behavior. #6

Closed
wants to merge 2 commits into from

4 participants

@randomcamel

Lee:

We use rsync to deploy code, and it leaves the timestamps all screwy for reasons I can't quite figure, so 'ls -xt' doesn't produce correct results, while 'ls -xr' does.

I understand if this patch won't product correct behavior for people who name their releases differently. If that's the case, please reject it, but would it make sense to provide some user-visible setting to alter the ls options? That seems like a more correct choice, but it's more than a 1-character change. =)

Chris


Change ls options from -xt to -xr, which fixes nondeterministic rollback behavior when our releases are named 20110404210241 (YYYYMMDDHHMMSS) but our modification times are unreliable (apparently because of rsync). Best thing would be to have the ls options be user-settable.

randomcamel added some commits
@randomcamel randomcamel Change ls options from -xt to -xr, which fixes nondeterministic rollb…
…ack behavior when our releases are named 20110404210241 (YYYYMMDDHHMMSS) but our modification times are unreliable (apparently because of rsync). Best thing would be to have the ls options be user-settable.
f10e323
@randomcamel randomcamel Expose an 'ls_opts' variable that users can set in deploy.rb. f23bd3f
@leehambley
@randomcamel

Lee:

I'll be frank, I have no idea how this might be useful to anyone else outside railsless-deploy. :-) It became sort of an urgent thing for me, because without it, deploy:rollback deletes a semi-random release and symlinks back to some other semi-random release. That may or may not be my co-worker's fault with the rsync deploy task we use. It's possible something more general is appropriate, like passing a full Unix command to produce a correctly--ordered list of releases.

Chris

@koenvw

Hi, I came across this also and the nondeterministic behavior has been fixed in capistano by sorting the releases in ruby and not via ls.

See capistrano/capistrano@8638f22#lib/capistrano/recipes/deploy.rb

@plentz

+1

@leehambley leehambley closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2011
  1. @randomcamel

    Change ls options from -xt to -xr, which fixes nondeterministic rollb…

    randomcamel authored
    …ack behavior when our releases are named 20110404210241 (YYYYMMDDHHMMSS) but our modification times are unreliable (apparently because of rsync). Best thing would be to have the ls options be user-settable.
  2. @randomcamel
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/railsless-deploy.rb
View
4 lib/railsless-deploy.rb
@@ -28,6 +28,8 @@ def _cset(name, *args, &block)
_cset(:deploy_to) { "/u/apps/#{application}" }
_cset(:revision) { source.head }
+_cset(:ls_opts) { "-xt" }
+
# =========================================================================
# These variables should NOT be changed unless you are very confident in
# what you are doing. Make sure you understand all the implications of your
@@ -51,7 +53,7 @@ def _cset(name, *args, &block)
_cset(:current_path) { File.join(deploy_to, current_dir) }
_cset(:release_path) { File.join(releases_path, release_name) }
- _cset(:releases) { capture("ls -xt #{releases_path}").split.reverse }
+ _cset(:releases) { capture("ls #{ls_opts} #{releases_path}").split.reverse }
_cset(:current_release) { File.join(releases_path, releases.last) }
_cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
Something went wrong with that request. Please try again.