jqr/heroku_san

Heroku deploy rake task is returning successful unix exit code even on failure

robotarmy opened this issue · 4 comments

This is making it hard to detect error conditions.

git update-ref refs/heroku_san/deploy jenkins-XXXXX-Landing-100^{commit}
git push git@heroku.com:XXXX-staging.git  refs/heroku_san/deploy:refs/heads/master
fatal: The remote end hung up unexpectedly
git update-ref -d refs/heroku_san/deploy
rake aborted!
Command failed with status (128): [git push git@heroku.com:XXXX-staging.g...]
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/git.rb:22:in `git_push'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/stage.rb:53:in `push'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/deploy/base.rb:11:in `deploy'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/deploy/rails.rb:8:in `deploy'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/stage.rb:63:in `deploy'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/tasks.rb:209:in `block (3 levels) in <top (required)>'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/project.rb:63:in `block in each_app'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/project.rb:62:in `each'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/project.rb:62:in `each_app'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/tasks.rb:321:in `each_heroku_app'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/gems/heroku_san-4.0.7/lib/heroku_san/tasks.rb:208:in `block (2 levels) in <top (required)>'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/bin/ruby_noexec_wrapper:14:in `eval'
/Users/Shared/Jenkins/.rvm/gems/ruby-1.9.2-p320@XXX-landing/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => heroku:deploy
(See full trace by running task with --trace)
-|SUCCESS|-> deploying to heroku
POST BUILD TASK : SUCCESS

I created a little test app (from heroku_san's test suite) and then went back 1 revision to create a fault. The exit code was 1, as expected. I'm not sure why your jenkins task is failing. Perhaps you are wrapping the rake task in a script and the script is not exiting (set -e) right away.

pivotal-guest-144:test_app (master) km$ git co HEAD^
Note: checking out 'HEAD^'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 13929f1... Added droids
pivotal-guest-144:test_app ((no branch)) km$ rake deploy
Defaulting to "test_app" since only one app is defined
git update-ref refs/heroku_san/deploy HEAD^{commit}
git push git@heroku.com:calm-plateau-2920.git  refs/heroku_san/deploy:refs/heads/master
To git@heroku.com:calm-plateau-2920.git
 ! [rejected]        refs/heroku_san/deploy -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:calm-plateau-2920.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git update-ref -d refs/heroku_san/deploy
rake aborted!
Command failed with status (1): [git push git@heroku.com:calm-plateau-2920....]
/Users/kmayer/workspace/heroku_san/lib/git.rb:22:in `git_push'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/stage.rb:53:in `push'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/deploy/base.rb:11:in `deploy'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/deploy/rails.rb:8:in `deploy'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/stage.rb:63:in `deploy'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:209:in `block (3 levels) in <top (required)>'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:63:in `block in each_app'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:62:in `each'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:62:in `each_app'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:321:in `each_heroku_app'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:208:in `block (2 levels) in <top (required)>'
/Users/kmayer/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/Users/kmayer/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => deploy => heroku:deploy
(See full trace by running task with --trace)
pivotal-guest-144:test_app ((no branch)) km$ echo $?
1

From the initial report:

rake aborted!
Command failed with status (128): [git push git@heroku.com:XXXX-staging.g...]

The rake task exited with status 128 -- so it is even more likely that you should check your build script.

I'm executing the script via 'bundle exec' that may be the issue.

Thank you for your consideration!

what does set -e do?

I am wrapping the task in a sh script and i'm checking $? after each
execution and forwarding the exit code to exit if non-zero

On Mon, Jan 21, 2013 at 5:04 PM, Ken Mayer notifications@github.com wrote:

I created a little test app (from heroku_san's test suite) and then went
back 1 revision to create a fault. The exit code was 1, as expected. I'm
not sure why your jenkins task is failing. Perhaps you are wrapping the
rake task in a script and the script is not exiting (set -e) right away.

pivotal-guest-144:test_app (master) km$ git co HEAD^
Note: checking out 'HEAD^'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you maydo so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 13929f1... Added droids
pivotal-guest-144:test_app ((no branch)) km$ rake deploy
Defaulting to "test_app" since only one app is defined
git update-ref refs/heroku_san/deploy HEAD^{commit}
git push git@heroku.com:calm-plateau-2920.git refs/heroku_san/deploy:refs/heads/master
To git@heroku.com:calm-plateau-2920.git
! [rejected] refs/heroku_san/deploy -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:calm-plateau-2920.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git update-ref -d refs/heroku_san/deploy
rake aborted!
Command failed with status (1): [git push git@heroku.com:calm-plateau-2920....]
/Users/kmayer/workspace/heroku_san/lib/git.rb:22:in git_push'/Users/kmayer/workspace/heroku_san/lib/heroku_san/stage.rb:53:inpush'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/deploy/base.rb:11:in deploy'/Users/kmayer/workspace/heroku_san/lib/heroku_san/deploy/rails.rb:8:indeploy'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/stage.rb:63:in deploy'/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:209:inblock (3 levels) in <top (required)>'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:63:in block in each_app'/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:62:ineach'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:62:in each_app'/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:321:ineach_heroku_app'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:208:in block (2 levels) in <top (required)>'/Users/kmayer/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:ineval'
/Users/kmayer/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `

'
Tasks: TOP => deploy => heroku:deploy(See full trace by running task with --trace)
pivotal-guest-144:test_app ((no branch)) km$ echo $?
1


Reply to this email directly or view it on GitHubhttps://github.com//issues/123#issuecomment-12525849.


Modern Yoga vs Traditional Yoga
http://swamij.com/traditional-yoga.htm#swamirama

set -e tells your bash script to exit immediately if any command exits
with a non-zero status

On Mon, Jan 21, 2013 at 5:11 PM, Curtis Schofield
notifications@github.comwrote:

I'm executing the script via 'bundle exec' that may be the issue.

Thank you for your consideration!

what does set -e do?

I am wrapping the task in a sh script and i'm checking $? after each
execution and forwarding the exit code to exit if non-zero

On Mon, Jan 21, 2013 at 5:04 PM, Ken Mayer notifications@github.com
wrote:

I created a little test app (from heroku_san's test suite) and then went
back 1 revision to create a fault. The exit code was 1, as expected. I'm
not sure why your jenkins task is failing. Perhaps you are wrapping the
rake task in a script and the script is not exiting (set -e) right away.

pivotal-guest-144:test_app (master) km$ git co HEAD^
Note: checking out 'HEAD^'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in
this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you
maydo so (now or later) by using -b with the checkout command again.
Example:

git checkout -b new_branch_name

HEAD is now at 13929f1... Added droids
pivotal-guest-144:test_app ((no branch)) km$ rake deploy
Defaulting to "test_app" since only one app is defined
git update-ref refs/heroku_san/deploy HEAD^{commit}
git push git@heroku.com:calm-plateau-2920.git
refs/heroku_san/deploy:refs/heads/master
To git@heroku.com:calm-plateau-2920.git
! [rejected] refs/heroku_san/deploy -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:calm-plateau-2920.git'

hint: Updates were rejected because a pushed branch tip is behind its
remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for
details.
git update-ref -d refs/heroku_san/deploy
rake aborted!
Command failed with status (1): [git push git@heroku.com:calm-plateau-2920....]

/Users/kmayer/workspace/heroku_san/lib/git.rb:22:in
git_push'/Users/kmayer/workspace/heroku_san/lib/heroku_san/stage.rb:53:in push'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/deploy/base.rb:11:in
deploy'/Users/kmayer/workspace/heroku_san/lib/heroku_san/deploy/rails.rb:8:in deploy'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/stage.rb:63:in
deploy'/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:209:in block (3 levels) in <top (required)>'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:63:in
block in each_app'/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:62:in each'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/project.rb:62:in
each_app'/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:321:in each_heroku_app'
/Users/kmayer/workspace/heroku_san/lib/heroku_san/tasks.rb:208:in block (2 levels) in <top (required)>'/Users/kmayer/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in eval'
/Users/kmayer/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in
`

'
Tasks: TOP => deploy => heroku:deploy(See full trace by running task
with --trace)
pivotal-guest-144:test_app ((no branch)) km$ echo $?
1


Reply to this email directly or view it on GitHub<
https://github.com/fastestforward/heroku_san/issues/123#issuecomment-12525849>.


Modern Yoga vs Traditional Yoga
http://swamij.com/traditional-yoga.htm#swamirama


Reply to this email directly or view it on GitHubhttps://github.com//issues/123#issuecomment-12526009.