Web Hook test fails with Error 500 when routing to raw Gitlab URL
Created by: bacongobbler
Using Gitlab 5-2-stable.
I have a Gitlab server with a repository for a Jekyll blog site I'm creating. in the project directory I have created a scripts/ folder to help automate deployment for the blog. What I am trying to do is to set up one of those scripts in a Gitlab Web hook so that when a git push occurs on the master branch, it will automagically deploy to my server. here is the script file:
#!/bin/sh
GIT_REPO=$HOME/repositories/bacongobbler/blog.git
TMP_GIT_CLONE=$HOME/tmp/blog
PUBLIC_WWW=/var/www/blog
git clone $GIT_REPO $TMP_GIT_CLONE
cd $TMP_GIT_CLONE && jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
cd ~ && rm -rf $TMP_GIT_CLONE
find $PUBLIC_WWW -type f -print0 | xargs -0 chmod 666
find $PUBLIC_WWW -type d -print0 | xargs -0 chmod 777
exit
And in the projects Hook settings, I have set up this:
http:///bacongobbler/blog/raw/master/scripts/deploy
However, whenever I try to test the web hook, I get a server error 500:
Started GET "/bacongobbler/blog/hooks/2/test" for at 2013-06-21 16:29:52 -0400
Processing by HooksController#test as HTML
Parameters: {"project_id"=>"bacongobbler/blog", "id"=>"2"}
Completed 500 Internal Server Error in 10154ms
Timeout::Error (Timeout::Error):
app/models/web_hook.rb:28:in `execute'
app/contexts/test_hook_context.rb:5:in `execute'
app/controllers/hooks_controller.rb:26:in `test'
Started POST "/bacongobbler/blog/raw/master/scripts/deploy" for at 2013-06-21 16:30:04 -0400
ActionController::RoutingError (No route matches [POST] "/bacongobbler/blog/raw/master/scripts/deploy"):
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in `pass'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in `invalidate'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in `call!'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
vendor/bundle/ruby/1.9.1/gems/puma-2.0.1/lib/puma/configuration.rb:66:in `call'
vendor/bundle/ruby/1.9.1/gems/puma-2.0.1/lib/puma/server.rb:364:in `handle_request'
vendor/bundle/ruby/1.9.1/gems/puma-2.0.1/lib/puma/server.rb:243:in `process_client'
vendor/bundle/ruby/1.9.1/gems/puma-2.0.1/lib/puma/server.rb:142:in `block in run'
vendor/bundle/ruby/1.9.1/gems/puma-2.0.1/lib/puma/thread_pool.rb:92:in `call'
vendor/bundle/ruby/1.9.1/gems/puma-2.0.1/lib/puma/thread_pool.rb:92:in `block in spawn_thread'
However, throwing the script on http://hastebin.com/raw/sidureqidi show this:
Started GET "/bacongobbler/blog/hooks/3/test" for at 2013-06-21 16:32:09 -0400
Processing by HooksController#test as HTML
Parameters: {"project_id"=>"bacongobbler/blog", "id"=>"3"}
Redirected to http://gitlab.bacongobbler.com/bacongobbler/blog/hooks
Completed 302 Found in 408ms (ActiveRecord: 0.4ms)
Started GET "/bacongobbler/blog/hooks" for at 2013-06-21 16:32:10 -0400
Processing by HooksController#index as HTML
Parameters: {"project_id"=>"bacongobbler/blog"}
Rendered projects/_settings_nav.html.haml (1.9ms)
Rendered hooks/index.html.haml within layouts/project_resource (6.4ms)
Rendered layouts/_head.html.haml (1.5ms)
Rendered layouts/_search.html.haml (17.1ms)
Rendered layouts/_head_panel.html.haml (80.0ms)
Rendered layouts/_init_auto_complete.html.haml (4.6ms)
Rendered layouts/_flash.html.haml (0.1ms)
Rendered shared/_no_ssh.html.haml (0.9ms)
Rendered layouts/nav/_project.html.haml (12.7ms)
Completed 200 OK in 131ms (Views: 110.3ms | ActiveRecord: 1.8ms)
bundle exec rake gitlab:check RAILS_ENV=production checks out with no issues
last SHA is 6a868a4c
GitLab env output:
git@bacongobbler:~/gitlab$ bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: Ubuntu 12.04
Current User: git
Using RVM: no
Ruby Version: 1.9.3p0
Gem Version: 1.8.11
Bundler Version:1.3.5
Rake Version: 10.0.4
GitLab information
Version: 5.2.1
Revision: 6a868a4
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://gitlab.bacongobbler.com
HTTP Clone URL: http://gitlab.bacongobbler.com/some-project.git
SSH Clone URL: [email protected]:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.4.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/local/bin/git