capistrano-plugins / capistrano-faster-assets

Skips asset compilation if none of the assets were changed since last release.
MIT License
186 stars 38 forks source link

When using RVM, with a .rvmrc file, the backup manifest breaks. #9

Open TJM opened 9 years ago

TJM commented 9 years ago

Our server is using RVM, and we are using a .rvmrc (because it is still the best place to put export RAILS_ENV=staging that I have found). This obnoxious message comes up on a newly provisioned server, and breaks the deploy:assets:backup_manifest task.

Easy workaround: rvm rvmrc warning ignore all.rvmrcs

 INFO [224cd57f] Running /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup on stage.example.com
DEBUG [224cd57f] Command: cd /web/railsapp/staging/releases/20150610202127 && /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup
DEBUG [224cd57f]    You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
DEBUG [224cd57f]    you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
DEBUG [224cd57f]    or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
DEBUG [224cd57f]    '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
DEBUG [224cd57f]    to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
DEBUG [224cd57f]    
DEBUG [224cd57f]    cp: target ‘managers,\r’ is not a directory
DEBUG [224cd57f]    bash: line 1: you: command not found
DEBUG [224cd57f]    bash: line 2: or: command not found
DEBUG [224cd57f]    bash: line 3: .rvmrc: command not found
DEBUG [224cd57f]    bash: line 4: to: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Command::Failed: cp exit status: 126
cp stdout: Nothing written
cp stderr: Nothing written

Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: cp exit status: 126
cp stdout: Nothing written
cp stderr: Nothing written

``` INFO [224cd57f] Running /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup on stage.example.com
DEBUG [224cd57f] Command: cd /web/railsapp/staging/releases/20150610202127 && /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup
DEBUG [224cd57f]    You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
DEBUG [224cd57f]    you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
DEBUG [224cd57f]    or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
DEBUG [224cd57f]    '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
DEBUG [224cd57f]    to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
DEBUG [224cd57f]    
DEBUG [224cd57f]    cp: target ‘managers,\r’ is not a directory
DEBUG [224cd57f]    bash: line 1: you: command not found
DEBUG [224cd57f]    bash: line 2: or: command not found
DEBUG [224cd57f]    bash: line 3: .rvmrc: command not found
DEBUG [224cd57f]    bash: line 4: to: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Command::Failed: cp exit status: 126
cp stdout: Nothing written
cp stderr: Nothing written

Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: cp exit status: 126
cp stdout: Nothing written
cp stderr: Nothing written
rhomeister commented 9 years ago

This doesn't seem to be a problem with this gem. Have you reported this to the RVM team?

On 10 June 2015 at 22:29, Tommy McNeely notifications@github.com wrote:

Our server is using RVM, and we are using a .rvmrc (because it is still the best place to put export RAILS_ENV=staging that I have found). This obnoxious message comes up on a newly provisioned server, and breaks the deploy:assets:backup_manifest task.

Easy workaround: rvm rvmrc warning ignore all.rvmrcs

INFO [224cd57f] Running /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers, you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version' or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc', '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2, to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup on stage.example.com DEBUG [224cd57f] Command: cd /web/railsapp/staging/releases/20150610202127 && /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers, you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version' or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc', '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2, to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup DEBUG [224cd57f] You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers, DEBUG [224cd57f] you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version' DEBUG [224cd57f] or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc', DEBUG [224cd57f] '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2, DEBUG [224cd57f] to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'. DEBUG [224cd57f] DEBUG [224cd57f] cp: target ‘managers,\r’ is not a directory DEBUG [224cd57f] bash: line 1: you: command not found DEBUG [224cd57f] bash: line 2: or: command not found DEBUG [224cd57f] bash: line 3: .rvmrc: command not found DEBUG [224cd57f] bash: line 4: to: command not found (Backtrace restricted to imported tasks) cap aborted! SSHKit::Command::Failed: cp exit status: 126 cp stdout: Nothing written cp stderr: Nothing written

Tasks: TOP => deploy:assets:backup_manifest (See full trace by running task with --trace) The deploy has failed with an error: cp exit status: 126 cp stdout: Nothing written cp stderr: Nothing written


you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup on stage.example.com
DEBUG [224cd57f] Command: cd /web/railsapp/staging/releases/20150610202127 && /usr/bin/env cp You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.

/web/railsapp/staging/releases/20150610202127/public/assets/.sprockets-manifest-fd7e2ccc959215614bf6fc35b33e3f3a.json /web/railsapp/staging/releases/20150610202127/assets_manifest_backup
DEBUG [224cd57f]    You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
DEBUG [224cd57f]    you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
DEBUG [224cd57f]    or ignore this warning with 'rvm rvmrc warning ignore /web/railsapp/staging/.rvmrc',
DEBUG [224cd57f]    '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
DEBUG [224cd57f]    to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
DEBUG [224cd57f]
DEBUG [224cd57f]    cp: target ‘managers,\r’ is not a directory
DEBUG [224cd57f]    bash: line 1: you: command not found
DEBUG [224cd57f]    bash: line 2: or: command not found
DEBUG [224cd57f]    bash: line 3: .rvmrc: command not found
DEBUG [224cd57f]    bash: line 4: to: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Command::Failed: cp exit status: 126
cp stdout: Nothing written
cp stderr: Nothing written

Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: cp exit status: 126
cp stdout: Nothing written
cp stderr: Nothing written

—
Reply to this email directly or view it on GitHub
https://github.com/capistrano-plugins/capistrano-faster-assets/issues/9.
TJM commented 9 years ago

What I mean to say is that if you are going to pass the output of one shell command to the arguments of another, you should probably do it entirely inside a single shell, or deal with STDOUT vs STDERR differently.

EDIT: It would appear that https://github.com/capistrano-plugins/capistrano-faster-assets/blob/master/lib/capistrano/tasks/faster_assets.rake#L21 is using "capture()" which is supposed to only capture STDOUT according to https://github.com/capistrano/capistrano/wiki/2.x-dsl-action-inspection-capture#caveats ... but apparently something is amiss :)

On a separate, but related note, it seems like detecting the latest release is a bit over-complicated. Wouldn't it be easier to just use the "current_path" like they do for "conditionally_migrate" ?

https://github.com/capistrano/rails/blob/master/lib/capistrano/tasks/migrations.rake#L10

:-/

~tommy

rhomeister commented 9 years ago

Hi Tommy.

I'd be happy to accept a pull request for this as it seems that you already have located the cause of this problem. This gem is almost a verbatim copy of https://coderwall.com/p/aridag. If you see any way to improve it, you're more than welcome to help.

cheers, Ruben

On 11 June 2015 at 21:08, Tommy McNeely notifications@github.com wrote:

What I mean to say is that if you are going to pass the output of one shell command to the arguments of another, you should probably do it entirely inside a single shell, or deal with STDOUT vs STDERR differently.

— Reply to this email directly or view it on GitHub https://github.com/capistrano-plugins/capistrano-faster-assets/issues/9#issuecomment-111243631 .

TJM commented 9 years ago

OK, I will see if I can cook something up. The cp operation that was failing for me (as a result of the lines I pointed out) is also a bit concerning. I will take a look and see what I can come up with, but I am stuck in a puppet world right now.