How to Use Git Commit Hooks with Puppet Enterprise
Version control is a critical component of IT automation, especially when you're defining your infrastructure as code. In our 2013 DevOps survey report, we found that using version control was a foundational ingredient for high-performing businesses. We use Git here at Puppet Labs, and it's a common choice around the tech industry. As such, we see a lot interest from our users on topics such as setting up a Git workflow with Puppet code, and when talking about best practices managing Puppet environments. Below are some excerpts from a recent webinar presented by Reid Vandewiele where he demonstrated how to use Git with Puppet Enterprise. He demonstrated basic Git functionality, and also showed how you can do some sanity checks to prevent a buggy commit from bringing down your production environment. Git hooks provide a way to execute custom scripts when you're either committing code locally or pushing code to a remote repository. In this video, Reid shows you how to set up and test a pre-commit Git hook as well as a pre-receive Git hook. These hooks perform a series of syntax checks with the
puppet parser validatecommand as well as style checks with the
puppet-lintcommand. If either of those tools detect an error in your Puppet code, they'll prevent it from being committed and save your from breaking one of your environments. So pull up this page of Git hooks, sit back, relax, and get up to speed with using Git with Puppet Enterprise. If you'd like to see more videos like this, then be sure to check out our library of webinars.
- Watch this presentation on continuous integration for your Puppet code.
- Read about Git workflow and Puppet environments.
- Read about how Puppet Enterprise enables software-defined infrastructure.