Skip to content

Instantly share code, notes, and snippets.

@rlivsey
Created July 3, 2009 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rlivsey/140048 to your computer and use it in GitHub Desktop.
Save rlivsey/140048 to your computer and use it in GitHub Desktop.
git post-receive hook to trigger different Hudson build based on the branch
#!/usr/bin/env ruby
while (input = STDIN.read) != ''
rev_old, rev_new, ref = input.split(" ")
url = nil
if ref == "refs/heads/master"
url = "http://172.23.0.150:8080/job/Project%20Master/build"
elsif ref == "refs/heads/other-branch"
url = "http://172.23.0.150:8080/job/Project%20Other/build"
end
if url
puts "Trigger Hudson build (#{url})"
`wget #{url} > /dev/null 2>&1`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment