forked from nickanderson/nickanderson-cfengine-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit
More file actions
25 lines (20 loc) · 949 Bytes
/
Copy pathpre-commit
File metadata and controls
25 lines (20 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Author: Nick Anderson <nick@cmdln.org>
# Simple git pre-commit script to ensure the important files have proper syntax
# Run checks on promises.cf and failsafe.cf from the root of the repository
# (we expect thats where the files exist)
POLICYCHECK=$(/var/cfengine/bin/cf-promises -f $(git rev-parse --show-toplevel)/promises.cf)
FAILSAFECHECK=$(/var/cfengine/bin/cf-promises -f $(git rev-parse --show-toplevel)/failsafe.cf)
if [[ $POLICYCHECK != "" ]]; then
#/var/cfengine/bin/cf-promises -f $(git rev-parse --show-toplevel)/promises.cf
echo $POLICYCHECK
echo promises.cf check FAILED syntax check Aborting, we dont allow broken commits
exit 1
fi
if [[ $FAILSAFECHECK != "" ]]; then
#/var/cfengine/bin/cf-promises -f $(git rev-parse --show-toplevel)/failsafe.cf
echo $FAILSAFECHECK
echo failsafe.cf FAILED syntax check. Aborting, we dont allow broken commits
exit 1
fi
echo Syntax check all clear