Skip to content

Instantly share code, notes, and snippets.

@darkseed
Created September 30, 2011 08:00
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 darkseed/1253036 to your computer and use it in GitHub Desktop.
Save darkseed/1253036 to your computer and use it in GitHub Desktop.
puppet pre-receive hook
#!/bin/bash
while read old_sha1 new_sha1 refname anothervalue ; do
list=$(git show --pretty="format:" --name-only $new_sha1 | grep -e ".pp$")
for tmpfile in ${list}; do
git show ${new_sha1}:${tmpfile} | puppet --color=false --confdir=/tmp --vardir=/tmp --parseonly --ignoreimport
if [ "$?" -ne "0" ]; then exit 1; fi
done
done
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment