Skip to content
Permalink
Browse files

Improve 8857 docker hooks

* Clean handling when hook directories do not exist
* Skip directories in hook directories
* Only try to execute hook scripts that are executable

Change-Id: I147489ae3198a17e7a56ee3013aa31ab761e5f70
  • Loading branch information...
LarsMichelsen committed Aug 2, 2019
1 parent 7088861 commit 5435c56b145f74af2959a1d93ccee7f950b1dbfe
Showing with 9 additions and 6 deletions.
  1. +9 −6 docker/docker-entrypoint.sh
@@ -4,14 +4,17 @@ set -e -o pipefail
HOOKROOT=/docker-entrypoint.d

function exec_hook() {
HOOKDIR=$HOOKROOT/$1
if pushd "$HOOKDIR" >/dev/null 2>&1; then
for hook in ./*; do
echo "### Running $HOOKDIR/$hook"
./"$hook"
HOOKDIR="$HOOKROOT/$1"
if [ -d "$HOOKDIR" ]; then
pushd "$HOOKDIR" >/dev/null
for hook in *; do
if [ ! -d "$hook" ] && [ -x "$hook" ]; then
echo "### Running $HOOKDIR/$hook"
./"$hook" || true
fi
done
popd >/dev/null
fi
popd >/dev/null 2>&1
}

if [ -z "$CMK_SITE_ID" ]; then

0 comments on commit 5435c56

Please sign in to comment.
You can’t perform that action at this time.