Skip to content

Commit f26a91b

Browse files
committed
adding pre-receive r10k check and moving away from which to build in bash hash
1 parent ef52037 commit f26a91b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

commit_hooks/r10k_syntax_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script assumes you have installed r10k and will perform a syntax check on the Puppetfile if existing
44

55
echo "Performing a syntax check on the r10k Puppetfile:"
6-
r10k puppetfile check
6+
PUPPETFILE="$1" r10k puppetfile check
77

88
if [[ $? -ne 0 ]]
99
then

pre-receive

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ while read -r oldrev newrev refname; do
129129
echo "puppet-lint not installed. Skipping puppet-lint tests..."
130130
fi
131131
fi
132+
#r10k puppetfile syntax check
133+
if hash r10k >/dev/null 2>&1; then
134+
if [ "$changedfile" = "Puppetfile" ]; then
135+
${subhook_root}/r10k_syntax_check.sh $tmptree/$changedfile
136+
RC=$?
137+
if [ "$RC" -ne 0 ]; then
138+
failures=`expr $failures + 1`
139+
fi
140+
fi
141+
else
142+
echo "r10k not installed. Skipping r10k Puppetfile test..."
143+
fi
132144
done
133145
done
134146
rm -rf "$tmptree"

0 commit comments

Comments
 (0)