Skip to content

Instantly share code, notes, and snippets.

@winks
Forked from codec/r10k_deployment.rb
Created October 11, 2013 11:42
Show Gist options
  • Save winks/6933345 to your computer and use it in GitHub Desktop.
Save winks/6933345 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'webrick'
require 'json'
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
req.parse(STDIN)
json_payload = JSON.parse(req.query['payload'])
branch = json_payload['ref'].split('/')[-1]
pid = fork
if pid.nil? then
STDIN.reopen "/dev/null"
STDOUT.reopen "/dev/null", "a"
STDERR.reopen "/dev/null", "a"
exec('/usr/local/bin/r10k', 'deploy', 'environment', branch, '-p')
end
Process.detach(pid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment