Bug 970658 - ruby 1.9 cartridge defaults to "'bundle exec rake assets:precompile'"
ruby 1.9 cartridge defaults to "'bundle exec rake assets:precompile'"
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Hiro Asari
libra bugs
:
Depends On:
Blocks: 984991
  Show dependency treegraph
 
Reported: 2013-06-04 10:02 EDT by Erik M Jacobs
Modified: 2015-05-14 19:20 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 984991 (view as bug list)
Environment:
Last Closed: 2013-06-11 00:16:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Erik M Jacobs 2013-06-04 10:02:34 EDT
Description of problem:
It appears that the ruby 1.9 cartridge has a "bundle exec rake assets:precompile" in it by default somewhere.

Unfortunately, not all ruby/rack applications are rails, and, therefore, there may not be any default rake actions, let alone "assets:precompile".

Steps to Reproduce:
1. Create a ruby 1.9 application
2. Push code into it that has no rails/rake

Actual results:
remote: Precompiling with 'bundle exec rake assets:precompile'
remote: rake aborted!
remote: Don't know how to build task 'assets:precompile'
remote: 
remote: (See full trace by running task with --trace)

Expected results:
Should somehow figure out if we are using Rails or not and not try to do the precompile if the rake action doesn't exist.
Comment 1 Jhon Honce 2013-06-04 11:43:33 EDT
Please verify this is not an issue with the V2 cartridges.
Comment 2 Hiro Asari 2013-06-04 14:29:58 EDT
At the moment, on v2, 'set +e' and 'set -e' wrap the call to 'rake assets:precompile', so that the failure from this rake task is not fatal. The error message is annoying, but it should not stop the deployment.
Comment 3 Hiro Asari 2013-06-05 15:18:07 EDT
As for v1, STDERR is swallowed at the moment, so the user should not see this error message. (See https://bugzilla.redhat.com/show_bug.cgi?id=862919, which was fixed many months ago by https://github.com/openshift/origin-server/commit/e7dba7f.) I am not sure how the error message is showing up now.

Eric, can you check how recent your origin server is?
Comment 4 Hiro Asari 2013-06-05 15:34:36 EDT
Test case (ensure the server is using v1 cartridges):

rhc app create rack ruby-1.9 -l $RHC_USERNAME --server $RHC_SERVER
cd rack
touch Rakefile
curl -O https://gist.github.com/BanzaiMan/71d71d884937848d3184/raw/4824c4815eb785de278e356b9b8a22a347520a2f/Gemfile
bundle install
git add Rakefile Gemfile*
git commit -m 'empty Rakefile and Gemfile with "rake"'
git push
Comment 6 Hiro Asari 2013-06-05 15:37:36 EDT
Eric,

I confirmed the error message bubbling up to the git output in the latest server, so you don't have to do anything further. I apologize for the confusion.
Comment 7 openshift-github-bot 2013-06-05 18:35:14 EDT
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/2741c4b8020fb575199a275ed9581a7912a912d0
Bug 970658

Run 'rake assets:precompile' only if that Rake task is available.
Comment 8 Hiro Asari 2013-06-06 09:15:03 EDT
It should be tested on v1 (1.8 and 1.9) and v2 cartridges.
Comment 9 Meng Bo 2013-06-08 04:02:36 EDT
Tested on devenv_3336,

For both ruby1.9 and ruby1.8

With steps in comment#4, issue fixed.

Total 4 (delta 0), reused 0 (delta 0)
remote: Stopping Ruby cart
remote: Waiting for stop to finish
remote: Running build on Ruby cart
remote: Bundling RubyGems based on Gemfile/Gemfile.lock to repo/vendor/bundle with 'bundle install --deployment'
remote: Fetching source index for https://rubygems.org/
remote: which: no sudo in (/bin:/usr/bin:/usr/sbin)
remote: Installing rake (10.0.4) 
remote: Using bundler (1.0.21) 
remote: Your bundle is complete! It was installed into ./vendor/bundle
remote: Starting Ruby cart
To ssh://4faf90e4d00e11e287d822000a988362@rack18-bmengdev.dev.rhcloud.com/~/git/rack18.git/
   f23e4a1..dd9afb1  master -> master
Comment 10 Meng Bo 2013-06-08 04:21:06 EDT
For v1:

Total 4 (delta 1), reused 0 (delta 0)
remote: restart_on_add=false
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Done
remote: restart_on_add=false
remote: Running .openshift/action_hooks/pre_build
remote: Bundling RubyGems based on Gemfile/Gemfile.lock to repo/vendor/bundle with 'bundle install --deployment'
remote: Fetching gem metadata from https://rubygems.org/..
remote: Installing rake (10.0.4) 
remote: Using bundler (1.1.4) 
remote: Your bundle is complete! It was installed into ./vendor/bundle
remote: Running .openshift/action_hooks/build
remote: Running .openshift/action_hooks/deploy
remote: hot_deploy_added=false
remote: Done
remote: Running .openshift/action_hooks/post_deploy
To ssh://d573874ad0c611e2970622000a9aa12e@rack19-bmeng1.dev.rhcloud.com/~/git/rack19.git/
   d15f4ed..3d3449c  master -> master

Note You need to log in before you can comment on or make changes to this bug.