Skip to content

Instantly share code, notes, and snippets.

@reidmv
Last active August 29, 2015 14:22
Show Gist options
  • Save reidmv/4205d0a68e4efa757680 to your computer and use it in GitHub Desktop.
Save reidmv/4205d0a68e4efa757680 to your computer and use it in GitHub Desktop.
post-receive hook for r10k bare git repo
#!/bin/bash
url='http://puppetmaster.local:8088/payload'
branches=''
while read oldrev newrev refname; do
branch=$(echo $refname | sed -n 's/^refs\/heads\///p')
branches="${branches} ${branch}"
done
branches=$(echo $branches | tr ' ' '\n' | sort -u)
for branch in $branches; do
data="{\"ref\": \"${branch}\"}"
curl -k -H "content-type: application/json" --data "$data" "$url"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment