Skip to content

Instantly share code, notes, and snippets.

@mrmanc
Last active March 23, 2016 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmanc/c1ff6466dc8403c4561a to your computer and use it in GitHub Desktop.
Save mrmanc/c1ff6466dc8403c4561a to your computer and use it in GitHub Desktop.
Very rudimentary script to convert the payload of a generic GitHub push event webhook to port 5637 into an API call to notify a Go CD material of an update. Not production ready… intended to be used as a test. You will need to set up a .netrc file in the home directory of the user running the script. https://curl.haxx.se/docs/manpage.html#-n
#!/bin/bash
while true; do
echo -e 'HTTP/1.1 200 OK\r\n' | nc -d -l 5637 | grep git_url | sed -e "s/^.*\(git:\/\/[^\"]*\)\".*$/\1/" | xargs -I {} curl -s --netrc 'https://go.atcloud.io/go/api/material/notify/git' -X POST -d "repository_url={}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment