I have my cfengine (2 and 3) files in a git repository fronted by gitolite.

Users of this repo have a pre-commit hook that will perform syntax/promise checks on the files as needed. This works fine.

To protect against someone not having the pre-commit hook, I would like to add a hook in the bare repository on the gitolite server. I know I need to use a pre-receive or update.secondary hook. Beyond that, I'm stumped.

I've found a number of sites with instructions on doing this with PHP fies, but those can be checked individually, but to my (admittedly limited) understanding of cfengine I need all the cfengine files before I can check them.

Short of having the hook clone the repo, how do I go about doing this?


Indeed, at the moment you need to have all your CFEngine files available to check them, since you will get a failure if, for example, some needed file is not present or if no bundlesequence is defined, regardless of whether the file syntax is correct.

Given this, I think you would need to clone the repo in the server. Once the repo is cloned, you could have your hook just update it, to reduce performance impact.

  • 1
    And to note, you should use the update hook, not the pre-receive. The update will run for each individual branch, which is what you want. – Andrew M. Mar 3 '12 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.