Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rack app to listen for POST from Github post receive hook.
require 'rack'
module GithubPostReceiveServer
class RackApp
def handle_request
payload = @req.POST["payload"]
if payload.nil?
return Rack::Response.new('404 Not Found', 404)
end
ENV.delete('GIT_DIR')
$LOG.debug "Running r10k as UID #{Process.uid}..."
%x{/opt/puppet/bin/r10k deploy environment -p}
$LOG.debug "Done running r10k."
Rack::Response.new('OK', 200)
end
# Call is the entry point for all rack apps.
def call(env)
@req = Rack::Request.new(env)
@res = handle_request
@res.finish
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.