Bug 977317

Summary: Git push failed with error "CARTRIDGE_VERSION_2: line 1: 2: command not found"
Product: OpenShift Online Reporter: tuwannu
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.xCC: dmcphers
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-26 18:50:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description tuwannu 2013-06-24 10:05:49 UTC
Description of problem:
When pushing any code up to openshift, push is successful with the latest commit on the server. However, when attempting to access the website i.e. http://myapplication-myusername.rhcloud.com. The user sees 503 Service Temporarily Unavailable instead of the actual web page.

git push log shows error: "/var/lib/openshift/xxxxxxxxx//.env/CARTRIDGE_VERSION_2: line 1: 2: command not found". Checked CARTRIDGE_VERSION_2 and found that the file indeed contains only 1 line with one single character, the number "2", in it.

Version-Release number of selected component (if applicable):
Cartridge created with Rails Quickstart

How reproducible:
This happens every time I git push to openshift. I think it happened after the cartridge was updated to version 2.

Steps to Reproduce:
1. Edits any repo file and make a local commit
2. Do git push to ssh://xxxxxx.com/~/git/xxxxxx.git
3. Access via browser: http://myapplication-myusername.rhcloud.com

Actual results:
Git push is successful. The edited files appear on openshift server. However, the website becomes inaccessible with 503 Service Temporarily Unavailable. "git push" log returns the following messages...

##### LOG BEGINS #####
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master 
Pushing to ssh://xxxxxx.com/~/git/xxxxxx.git/
remote: [Mon Jun 24 05:37:41 2013] [warn] module php5_module is already loaded, skipping        
remote: Waiting for stop to finish        
remote: CLIENT_RESULT: Stopping CRON cart        
remote: [Mon Jun 24 05:37:47 2013] [warn] module php5_module is already loaded, skipping        
remote: Waiting for stop to finish        
remote: Stopping Ruby cart        
remote: Saving away previously bundled RubyGems        
remote: Running build on Ruby cart        
remote: Restoring previously bundled RubyGems (note: you can commit .openshift/markers/force_clean_build at the root of your repo to force a clean bundle)        
remote: Bundling RubyGems based on Gemfile/Gemfile.lock to repo/vendor/bundle with 'bundle install --deployment'        
remote: Using rake (10.0.3)         
remote: Using i18n (0.6.1)         
remote: Using multi_json (1.6.1)         
remote: Using activesupport (3.2.11)         
remote: Using builder (3.0.4)         
remote: Using activemodel (3.2.11)         
remote: Using erubis (2.7.0)         
remote: Using journey (1.0.4)         
remote: Using rack (1.4.5)         
remote: Using rack-cache (1.2)         
remote: Using rack-test (0.6.2)         
remote: Using hike (1.2.1)         
remote: Using tilt (1.3.3)         
remote: Using sprockets (2.2.2)         
remote: Using actionpack (3.2.11)         
remote: Using mime-types (1.21)         
remote: Using polyglot (0.3.3)         
remote: Using treetop (1.4.12)         
remote: Using mail (2.4.4)         
remote: Using actionmailer (3.2.11)         
remote: Using arel (3.0.2)         
remote: Using tzinfo (0.3.35)         
remote: Using activerecord (3.2.11)         
remote: Using activeresource (3.2.11)         
remote: Using coffee-script-source (1.4.0)         
remote: Using execjs (1.4.0)         
remote: Using coffee-script (2.2.0)         
remote: Using rack-ssl (1.3.3)         
remote: Using json (1.7.7)         
remote: Using rdoc (3.12.1)         
remote: Using thor (0.14.6)         
remote: Using railties (3.2.11)         
remote: Using coffee-rails (3.2.2)         
remote: Using jquery-rails (2.2.1)         
remote: Using minitest (4.6.1)         
remote: Using mysql2 (0.3.11)         
remote: Using nokogiri (1.5.6)         
remote: Using rabl (0.8.0)         
remote: Using bundler (1.1.4)         
remote: Using rails (3.2.11)         
remote: Using sass (3.2.5)         
remote: Using sass-rails (3.2.6)         
remote: Using sqlite3 (1.3.7)         
remote: Using uglifier (1.3.0)         
remote: Your bundle is complete! It was installed into ./vendor/bundle        
remote: [Mon Jun 24 05:38:21 2013] [warn] module php5_module is already loaded, skipping        
remote: CLIENT_RESULT: Starting CRON cart        
remote: [Mon Jun 24 05:38:26 2013] [warn] module php5_module is already loaded, skipping        
remote: Precompiling with 'bundle exec rake assets:precompile'        
remote: /opt/rh/ruby193/root/usr/bin/ruby /var/lib/openshift/xxxxxx/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets        
remote: /var/lib/openshift/xxxxxxxxx//.env/CARTRIDGE_VERSION_2: line 1: 2: command not found        
remote: An error occurred executing 'gear postreceive'        
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.        
To ssh://xxxxxxxxx.com/~/git/xxxxxxxxx.git/
   d812b10..25a7558  master -> master
updating local tracking ref 'refs/remotes/origin/master'
Completed successfully
##### LOG ENDS #####

Expected results:
Git pushes successfully and the site is accessible right away without 503 Service Temporarily Unavailable.

Comment 1 Dan McPherson 2013-06-26 18:50:23 UTC
It appears your code has an old version of the deploy script which sources the Environment Variables under .env.  You're going to need to change your code to skip that step.  You can do that a couple ways:

1) You can make sure deploy hook look like:

https://github.com/openshift/rails-example/blob/master/.openshift/action_hooks/deploy

or:

2) You could rebase on the upstream quickstart:

Details here:

https://www.openshift.com/blogs/version-2-cartridge-update-action-may-be-required


Please reopen if you are still having problems.