Skip to content

srianirudh84/puppet-git-hooks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

puppet-git-hooks

Git hooks to assist puppet module development. Client side hooks allow for various checks before commits are staged. Server side hooks are provided for infrastructural reinformence of various standardaizations compliance.

Current supported pre-commit (client side) checks

  • Puppet manifest syntax
  • Erb template syntax
  • Puppet-lint
  • Rspec-puppet
  • Yaml (hiera data) syntax
  • r10k puppetfile syntax

Current supported pre-receive (server side) checks

  • Puppet manifest syntax
  • Erb template syntax
  • Puppet-lint
  • Yaml (hiera data) syntax

Usage

In your git repository you can symlink the pre-commit file from this repository to the .git/hooks/pre-commit of your repository you want to implement this feature.

$ ln -s /path/to/this/repo/puppet-git-hooks/pre-commit .git/hooks/pre-commit

If you are using git submodules this can be achieved by getting the gitdir from the .git file in your submodule and symlinking to that gitdir location/

$ cat .git
$ ln -s /path/to/this/repo/puppet-git-hooks/pre-commit ../path/to/git/dir/from/previous/command/hooks/pre-commit

deploy-git-hook

usage: deploy-git-hook -d /path/to/git/repository [-a] [-c] [-r] [-u]

-h            this help screen
-d path       install the hooks to the specified path
-a            deploy pre-commit and pre-receive hooks
-c            deploy only the pre-commit hook
-r            deploy only the pre-receive hook
-u            deploy only the post-update hook

returns status code of 0 for success, otherwise, failure

examples:

  1. to install pre-commit and pre-receive the hooks to foo git repo:
deploy-git-hook -d /path/to/foo -a
  1. to install only the pre-commit hook to bar git repo:
deploy-git-hook -d /path/to/bar -c
  1. to install only the pre-commit and pre-receive hook to foobar git repo:
deploy-git-hook -d /path/to/foobar -c -r

About

Git client and server side hooks for puppet development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%