This commit is contained in:
IamTheFij 2018-05-21 10:31:29 -07:00
rodzic 81177127ad
commit 16df7e8c2f
3 zmienionych plików z 41 dodań i 0 usunięć

6
.pre-commit-hooks.yaml Normal file
Wyświetl plik

@ -0,0 +1,6 @@
- id: docker-compose-check
name: Validate docker-compose files
description: Checks that vault files are encrypted
entry: compose-check.sh
files: docker-compose.y[a]{0,1}ml$
language: script

29
compose-check.sh Executable file
Wyświetl plik

@ -0,0 +1,29 @@
#! /bin/bash
# Verifies that files passed in are valid for docker-compose
set -e
check_file() {
local file=$1
docker-compose -f "$file" config -q 2>&1 \
| sed "/variable is not set. Defaulting/d"
return ${PIPESTATUS[0]}
}
check_files() {
local all_files=$@
has_error=0
for file in $all_files ; do
if [[ -f "$file" ]]; then
if ! check_file "$file" ; then
has_error=1
fi
fi
done
return $has_error
}
if ! check_files $@ ; then
echo "To ignore, use --no-verify"
fi
exit $has_error

6
hooks.yaml Normal file
Wyświetl plik

@ -0,0 +1,6 @@
- id: docker-compose-check
name: Validate docker-compose files
description: Checks that vault files are encrypted
entry: compose-check.sh
files: docker-compose.y[a]{0,1}ml$
language: script