feat: add a new plugin trigger for detecting what the current deployment method is
This is currently used solely for reporting. Closes #3047
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename "$0")" "$@"
|
||||
1
plugins/20_events/deploy-method
Symbolic link
1
plugins/20_events/deploy-method
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
@@ -15,6 +15,7 @@ report_single_app() {
|
||||
local flag_map=(
|
||||
"--app-dir: $APP_DIR"
|
||||
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)"
|
||||
"--deploy-method: $(plugn trigger deploy-method "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
|
||||
21
plugins/git/deploy-method
Executable file
21
plugins/git/deploy-method
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
git_deploy_method() {
|
||||
declare desc="git deploy-method plugin trigger"
|
||||
declare trigger="git_deploy_method"
|
||||
declare APP="$1"
|
||||
local STDIN=$(cat)
|
||||
|
||||
# bail if another method is detected
|
||||
if [[ -n "$STDIN" ]]; then
|
||||
echo "$STDIN"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -d "$DOKKU_ROOT/$APP/refs" ]]; then
|
||||
echo "git"
|
||||
fi
|
||||
}
|
||||
|
||||
git_deploy_method "$@"
|
||||
21
plugins/tar/deploy-method
Executable file
21
plugins/tar/deploy-method
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
tar_deploy_method() {
|
||||
declare desc="tar deploy-method plugin trigger"
|
||||
declare trigger="tar_deploy_method"
|
||||
declare APP="$1"
|
||||
local STDIN=$(cat)
|
||||
|
||||
# bail if another method is detected
|
||||
if [[ -n "$STDIN" ]]; then
|
||||
echo "$STDIN"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/src.tar" ]]; then
|
||||
echo "tar"
|
||||
fi
|
||||
}
|
||||
|
||||
tar_deploy_method "$@"
|
||||
Reference in New Issue
Block a user