From 9ae1baf4a0b4b49bb653d8002002d7cb48fe76ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Mik=C3=B3?= Date: Fri, 22 Nov 2024 17:51:39 +0100 Subject: [PATCH] feat: add support for running hooks --- .../rootfs/home/www-data/.local/bin/build.sh | 20 +++++--- .../home/www-data/.local/bin/build_test.sh | 48 +++++++++++++++++++ .../home/www-data/.local/bin/functions.sh | 11 +++++ .../www-data/.local/bin/functions_test.sh | 10 +++- .../home/www-data/.local/bin/install.sh | 21 +++++--- .../home/www-data/.local/bin/install_test.sh | 8 ++-- .../home/www-data/.local/bin/post-start.sh | 2 + .../home/www-data/.local/bin/pre-stop.sh | 2 + .../context/rootfs/usr/local/bin/build.sh | 20 +++++--- .../rootfs/usr/local/bin/build_test.sh | 48 +++++++++++++++++++ .../context/rootfs/usr/local/bin/functions.sh | 11 +++++ .../rootfs/usr/local/bin/functions_test.sh | 10 +++- .../context/rootfs/usr/local/bin/install.sh | 21 +++++--- .../rootfs/usr/local/bin/install_test.sh | 8 ++-- .../rootfs/usr/local/bin/post-start.sh | 2 + .../context/rootfs/usr/local/bin/pre-stop.sh | 2 + 16 files changed, 210 insertions(+), 34 deletions(-) diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build.sh index 48e96fdd..02454858 100755 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build.sh @@ -23,6 +23,7 @@ PHP_ARGS="-derror_reporting=${PHP_ERROR_REPORTING:-E_ALL} --memory_limit=${PHP_M _magento_command="bin/magento" MAGENTO_COMMAND="${MAGENTO_COMMAND:-php ${PHP_ARGS} ${_magento_command} --no-ansi --no-interaction}" readonly MAGENTO_COMMAND +unset _magento_command _magerun_command="n98-magerun2" if command -v mr 2>/dev/null; then @@ -30,6 +31,7 @@ if command -v mr 2>/dev/null; then fi MAGERUN_COMMAND="${MAGERUN_COMMAND:-php ${PHP_ARGS} ${_magerun_command} --no-ansi --no-interaction}" readonly MAGERUN_COMMAND +unset _magerun_command _composer_command="composer" if command -v composer 2>/dev/null; then @@ -37,18 +39,14 @@ if command -v composer 2>/dev/null; then fi COMPOSER_COMMAND="${COMPOSER_COMMAND:-php ${PHP_ARGS} ${_composer_command} --no-ansi --no-interaction}" readonly COMPOSER_COMMAND +unset _composer_command _n_command="n" if command -v n 2>/dev/null; then _n_command="$(command -v n 2>/dev/null)" fi N_COMMAND="${N_COMMAND:-${_n_command}}" - -check_requirements() { - check_command "mr" - check_command "composer" - check_command "n" -} +unset _n_command magento() { ${MAGENTO_COMMAND} "$@" @@ -62,6 +60,12 @@ n() { ${N_COMMAND} "$@" } +check_requirements() { + check_command "mr" + check_command "composer" + check_command "n" +} + command_before_build() { if [[ -z "${COMMAND_BEFORE_BUILD:-}" ]]; then return 0 @@ -210,6 +214,8 @@ dump_build_version() { } main() { + run_hooks "pre-build" + check_requirements command_before_build @@ -229,6 +235,8 @@ main() { dump_build_version command_after_build + + run_hooks "post-build" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build_test.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build_test.sh index e9dd6554..578f3fda 100644 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build_test.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/build_test.sh @@ -54,6 +54,54 @@ function test_composer_self_update() { unset COMPOSER_VERSION } +function test_composer_configure() { + # Default + local APP_PATH="./test-data" + mock composer echo + spy composer + composer_configure + assert_directory_exists "./test-data/var/composer_home" + assert_have_been_called_times 4 composer + + # Test if only MAGENTO_PUBLIC_KEY is set + local MAGENTO_PUBLIC_KEY="public" + spy composer + composer_configure + assert_have_been_called_times 4 composer + + # Test if only MAGENTO_PRIVATE_KEY is set + local MAGENTO_PUBLIC_KEY="" + local MAGENTO_PRIVATE_KEY="private" + spy composer + composer_configure + assert_have_been_called_times 4 composer + + local MAGENTO_PUBLIC_KEY="public" + local MAGENTO_PRIVATE_KEY="private" + spy composer + composer_configure + assert_have_been_called_times 5 composer + + local GITHUB_USER="user" + local GITHUB_TOKEN="token" + spy composer + composer_configure + assert_have_been_called_times 6 composer + + local BITBUCKET_PUBLIC_KEY="public" + local BITBUCKET_PRIVATE_KEY="private" + spy composer + composer_configure + assert_have_been_called_times 7 composer + + local GITLAB_TOKEN="token" + spy composer + composer_configure + assert_have_been_called_times 8 composer + + rm -fr "./test-data" +} + function test_composer_install() { spy composer composer_install diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions.sh index ebf5c04c..569d357f 100755 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions.sh @@ -134,3 +134,14 @@ check_command() { error "Error: $1 is required but not installed." fi } + +run_hooks() { + local hook="${1:-}" + if [[ -n "${hook}" ]] && [[ -d "$(app_path)/hooks/${hook}.d" ]]; then + for file in "$(app_path)"/hooks/"${hook}.d"/*.sh; do + log "Running ${file} for ${hook}" + # shellcheck disable=SC1090 + source "${file}" + done + fi +} diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions_test.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions_test.sh index c3a09dc8..0b1a72b7 100644 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions_test.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/functions_test.sh @@ -74,7 +74,7 @@ function test_app_path() { assert_equals "/app" "$(app_path)" } -function version_gt() { +function test_version_gt() { assert_true "$(version_gt '2.4.4' '2.3.99')" assert_false "$(version_gt '2.3.99' '2.4.4')" assert_false "$(version_gt '2.4.4' '2.4.4')" @@ -82,3 +82,11 @@ function version_gt() { assert_false "$(version_gt '2.3.99' '2.4')" assert_false "$(version_gt '2.4' '2.4')" } + +function test_run_hooks() { + local APP_PATH="./test-data/app" + mkdir -p "${APP_PATH}/hooks/test.d" + printf "#!/bin/bash\necho 'test-123'" >"${APP_PATH}/hooks/test.d/01-test.sh" + assert_contains "test-123" "$(run_hooks 'test')" + rm -fr "./test-data" +} diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install.sh index 862de779..e4a3b087 100755 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install.sh @@ -23,6 +23,7 @@ PHP_ARGS="-derror_reporting=${PHP_ERROR_REPORTING:-E_ALL} --memory_limit=${PHP_M _magento_command="bin/magento" MAGENTO_COMMAND="${MAGENTO_COMMAND:-php ${PHP_ARGS} ${_magento_command} --no-ansi --no-interaction}" readonly MAGENTO_COMMAND +unset _magento_command _magerun_command="n98-magerun2" if command -v mr 2>/dev/null; then @@ -30,6 +31,7 @@ if command -v mr 2>/dev/null; then fi MAGERUN_COMMAND="${MAGERUN_COMMAND:-php ${PHP_ARGS} ${_magerun_command} --no-ansi --no-interaction}" readonly MAGERUN_COMMAND +unset _magerun_command _composer_command="composer" if command -v composer 2>/dev/null; then @@ -37,11 +39,7 @@ if command -v composer 2>/dev/null; then fi COMPOSER_COMMAND="${COMPOSER_COMMAND:-php ${PHP_ARGS} ${_composer_command} --no-ansi --no-interaction}" readonly COMPOSER_COMMAND - -check_requirements() { - check_command "composer" - check_command "mr" -} +unset _composer_command magento() { ${MAGENTO_COMMAND} "$@" @@ -55,6 +53,11 @@ composer() { ${COMPOSER_COMMAND} "$@" } +check_requirements() { + check_command "composer" + check_command "mr" +} + command_before_install() { if [[ -z "${COMMAND_BEFORE_INSTALL:-}" ]]; then return 0 @@ -594,8 +597,6 @@ magento_publish_config() { } main() { - check_requirements - LOCKFILE="$(shared_config_path)/.deploy.lock" readonly LOCKFILE @@ -604,6 +605,10 @@ main() { lock_acquire "${LOCKFILE}" + run_hooks "pre-install" + + check_requirements + conditional_sleep command_before_install bootstrap_check @@ -630,6 +635,8 @@ main() { magento_publish_config command_after_install + + run_hooks "post-install" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install_test.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install_test.sh index b7e37ffb..e827a9e9 100644 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install_test.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/install_test.sh @@ -708,27 +708,29 @@ function test_bootstrap_check() { function test_composer_configure() { # Default local APP_PATH="./test-data" + mock composer echo spy composer composer_configure assert_directory_exists "./test-data/var/composer_home" # Test if only MAGENTO_PUBLIC_KEY is set local MAGENTO_PUBLIC_KEY="public" + spy composer composer_configure assert_have_been_called_times 0 composer # Test if only MAGENTO_PRIVATE_KEY is set local MAGENTO_PUBLIC_KEY="" local MAGENTO_PRIVATE_KEY="private" + spy composer composer_configure assert_have_been_called_times 0 composer local MAGENTO_PUBLIC_KEY="public" local MAGENTO_PRIVATE_KEY="private" + spy composer composer_configure - assert_have_been_called composer - # unset MAGENTO_PUBLIC_KEY - # unset MAGENTO_PRIVATE_KEY + assert_have_been_called_times 1 composer local GITHUB_USER="user" local GITHUB_TOKEN="token" diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/post-start.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/post-start.sh index 9a3f0277..3edc4831 100755 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/post-start.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/post-start.sh @@ -27,6 +27,8 @@ main() { trap 'trapinfo $LINENO ${BASH_LINENO[*]}' ERR create_symlink + + run_hooks "post-start" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/pre-stop.sh b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/pre-stop.sh index 3a51d9f2..3f4f8103 100755 --- a/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/pre-stop.sh +++ b/images/php-fpm-rootless/magento2-web/context/rootfs/home/www-data/.local/bin/pre-stop.sh @@ -26,6 +26,8 @@ main() { trap 'trapinfo $LINENO ${BASH_LINENO[*]}' ERR lock_deploy + + run_hooks "pre-stop" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build.sh index 48e96fdd..02454858 100755 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build.sh @@ -23,6 +23,7 @@ PHP_ARGS="-derror_reporting=${PHP_ERROR_REPORTING:-E_ALL} --memory_limit=${PHP_M _magento_command="bin/magento" MAGENTO_COMMAND="${MAGENTO_COMMAND:-php ${PHP_ARGS} ${_magento_command} --no-ansi --no-interaction}" readonly MAGENTO_COMMAND +unset _magento_command _magerun_command="n98-magerun2" if command -v mr 2>/dev/null; then @@ -30,6 +31,7 @@ if command -v mr 2>/dev/null; then fi MAGERUN_COMMAND="${MAGERUN_COMMAND:-php ${PHP_ARGS} ${_magerun_command} --no-ansi --no-interaction}" readonly MAGERUN_COMMAND +unset _magerun_command _composer_command="composer" if command -v composer 2>/dev/null; then @@ -37,18 +39,14 @@ if command -v composer 2>/dev/null; then fi COMPOSER_COMMAND="${COMPOSER_COMMAND:-php ${PHP_ARGS} ${_composer_command} --no-ansi --no-interaction}" readonly COMPOSER_COMMAND +unset _composer_command _n_command="n" if command -v n 2>/dev/null; then _n_command="$(command -v n 2>/dev/null)" fi N_COMMAND="${N_COMMAND:-${_n_command}}" - -check_requirements() { - check_command "mr" - check_command "composer" - check_command "n" -} +unset _n_command magento() { ${MAGENTO_COMMAND} "$@" @@ -62,6 +60,12 @@ n() { ${N_COMMAND} "$@" } +check_requirements() { + check_command "mr" + check_command "composer" + check_command "n" +} + command_before_build() { if [[ -z "${COMMAND_BEFORE_BUILD:-}" ]]; then return 0 @@ -210,6 +214,8 @@ dump_build_version() { } main() { + run_hooks "pre-build" + check_requirements command_before_build @@ -229,6 +235,8 @@ main() { dump_build_version command_after_build + + run_hooks "post-build" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build_test.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build_test.sh index e9dd6554..578f3fda 100644 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build_test.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/build_test.sh @@ -54,6 +54,54 @@ function test_composer_self_update() { unset COMPOSER_VERSION } +function test_composer_configure() { + # Default + local APP_PATH="./test-data" + mock composer echo + spy composer + composer_configure + assert_directory_exists "./test-data/var/composer_home" + assert_have_been_called_times 4 composer + + # Test if only MAGENTO_PUBLIC_KEY is set + local MAGENTO_PUBLIC_KEY="public" + spy composer + composer_configure + assert_have_been_called_times 4 composer + + # Test if only MAGENTO_PRIVATE_KEY is set + local MAGENTO_PUBLIC_KEY="" + local MAGENTO_PRIVATE_KEY="private" + spy composer + composer_configure + assert_have_been_called_times 4 composer + + local MAGENTO_PUBLIC_KEY="public" + local MAGENTO_PRIVATE_KEY="private" + spy composer + composer_configure + assert_have_been_called_times 5 composer + + local GITHUB_USER="user" + local GITHUB_TOKEN="token" + spy composer + composer_configure + assert_have_been_called_times 6 composer + + local BITBUCKET_PUBLIC_KEY="public" + local BITBUCKET_PRIVATE_KEY="private" + spy composer + composer_configure + assert_have_been_called_times 7 composer + + local GITLAB_TOKEN="token" + spy composer + composer_configure + assert_have_been_called_times 8 composer + + rm -fr "./test-data" +} + function test_composer_install() { spy composer composer_install diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions.sh index ebf5c04c..569d357f 100755 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions.sh @@ -134,3 +134,14 @@ check_command() { error "Error: $1 is required but not installed." fi } + +run_hooks() { + local hook="${1:-}" + if [[ -n "${hook}" ]] && [[ -d "$(app_path)/hooks/${hook}.d" ]]; then + for file in "$(app_path)"/hooks/"${hook}.d"/*.sh; do + log "Running ${file} for ${hook}" + # shellcheck disable=SC1090 + source "${file}" + done + fi +} diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions_test.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions_test.sh index c3a09dc8..0b1a72b7 100644 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions_test.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/functions_test.sh @@ -74,7 +74,7 @@ function test_app_path() { assert_equals "/app" "$(app_path)" } -function version_gt() { +function test_version_gt() { assert_true "$(version_gt '2.4.4' '2.3.99')" assert_false "$(version_gt '2.3.99' '2.4.4')" assert_false "$(version_gt '2.4.4' '2.4.4')" @@ -82,3 +82,11 @@ function version_gt() { assert_false "$(version_gt '2.3.99' '2.4')" assert_false "$(version_gt '2.4' '2.4')" } + +function test_run_hooks() { + local APP_PATH="./test-data/app" + mkdir -p "${APP_PATH}/hooks/test.d" + printf "#!/bin/bash\necho 'test-123'" >"${APP_PATH}/hooks/test.d/01-test.sh" + assert_contains "test-123" "$(run_hooks 'test')" + rm -fr "./test-data" +} diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install.sh index 862de779..e4a3b087 100755 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install.sh @@ -23,6 +23,7 @@ PHP_ARGS="-derror_reporting=${PHP_ERROR_REPORTING:-E_ALL} --memory_limit=${PHP_M _magento_command="bin/magento" MAGENTO_COMMAND="${MAGENTO_COMMAND:-php ${PHP_ARGS} ${_magento_command} --no-ansi --no-interaction}" readonly MAGENTO_COMMAND +unset _magento_command _magerun_command="n98-magerun2" if command -v mr 2>/dev/null; then @@ -30,6 +31,7 @@ if command -v mr 2>/dev/null; then fi MAGERUN_COMMAND="${MAGERUN_COMMAND:-php ${PHP_ARGS} ${_magerun_command} --no-ansi --no-interaction}" readonly MAGERUN_COMMAND +unset _magerun_command _composer_command="composer" if command -v composer 2>/dev/null; then @@ -37,11 +39,7 @@ if command -v composer 2>/dev/null; then fi COMPOSER_COMMAND="${COMPOSER_COMMAND:-php ${PHP_ARGS} ${_composer_command} --no-ansi --no-interaction}" readonly COMPOSER_COMMAND - -check_requirements() { - check_command "composer" - check_command "mr" -} +unset _composer_command magento() { ${MAGENTO_COMMAND} "$@" @@ -55,6 +53,11 @@ composer() { ${COMPOSER_COMMAND} "$@" } +check_requirements() { + check_command "composer" + check_command "mr" +} + command_before_install() { if [[ -z "${COMMAND_BEFORE_INSTALL:-}" ]]; then return 0 @@ -594,8 +597,6 @@ magento_publish_config() { } main() { - check_requirements - LOCKFILE="$(shared_config_path)/.deploy.lock" readonly LOCKFILE @@ -604,6 +605,10 @@ main() { lock_acquire "${LOCKFILE}" + run_hooks "pre-install" + + check_requirements + conditional_sleep command_before_install bootstrap_check @@ -630,6 +635,8 @@ main() { magento_publish_config command_after_install + + run_hooks "post-install" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install_test.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install_test.sh index b7e37ffb..e827a9e9 100644 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install_test.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/install_test.sh @@ -708,27 +708,29 @@ function test_bootstrap_check() { function test_composer_configure() { # Default local APP_PATH="./test-data" + mock composer echo spy composer composer_configure assert_directory_exists "./test-data/var/composer_home" # Test if only MAGENTO_PUBLIC_KEY is set local MAGENTO_PUBLIC_KEY="public" + spy composer composer_configure assert_have_been_called_times 0 composer # Test if only MAGENTO_PRIVATE_KEY is set local MAGENTO_PUBLIC_KEY="" local MAGENTO_PRIVATE_KEY="private" + spy composer composer_configure assert_have_been_called_times 0 composer local MAGENTO_PUBLIC_KEY="public" local MAGENTO_PRIVATE_KEY="private" + spy composer composer_configure - assert_have_been_called composer - # unset MAGENTO_PUBLIC_KEY - # unset MAGENTO_PRIVATE_KEY + assert_have_been_called_times 1 composer local GITHUB_USER="user" local GITHUB_TOKEN="token" diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/post-start.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/post-start.sh index 9a3f0277..3edc4831 100755 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/post-start.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/post-start.sh @@ -27,6 +27,8 @@ main() { trap 'trapinfo $LINENO ${BASH_LINENO[*]}' ERR create_symlink + + run_hooks "post-start" } (return 0 2>/dev/null) && sourced=1 diff --git a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/pre-stop.sh b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/pre-stop.sh index 3a51d9f2..3f4f8103 100755 --- a/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/pre-stop.sh +++ b/images/php-fpm/magento2-web/context/rootfs/usr/local/bin/pre-stop.sh @@ -26,6 +26,8 @@ main() { trap 'trapinfo $LINENO ${BASH_LINENO[*]}' ERR lock_deploy + + run_hooks "pre-stop" } (return 0 2>/dev/null) && sourced=1