Skip to content

Instantly share code, notes, and snippets.

@jperras
Created December 22, 2011 21:05
Show Gist options
  • Save jperras/1511849 to your computer and use it in GitHub Desktop.
Save jperras/1511849 to your computer and use it in GitHub Desktop.
A git post-receive hook for making puppet suck less.
#!/bin/sh
echo "[NOTICE] *** Starting post-receive hook."
cd /etc/puppet
unset GIT_DIR
git fetch origin
if [ "$?" -ne "0" ]; then
echo "[FATAL] Could not fetch origin. Aborting."
exit $?
fi
git reset --hard HEAD
if [ "$?" -ne "0" ]; then
echo "[FATAL] Could not reset head. Aborting."
exit $?
fi
git push all master
if [ "$?" -ne "0" ]; then
echo "[FATAL] Could Push to all nodes. Aborting."
exit $?
fi
echo "[NOTICE] All relevant remotes have been updated."
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment