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 parent
be79060d7e
commit
c9d9750afe
7 files changed
+75
-7
No files matched your search
@@ -170,11 +170,13 @@ dokku apps:report
|
|||||||
=====> node-js-app
|
=====> node-js-app
|
||||||
App dir: /home/dokku/node-js-app
|
App dir: /home/dokku/node-js-app
|
||||||
Git sha: dbddc3f
|
Git sha: dbddc3f
|
||||||
|
Deploy method: git
|
||||||
=====> python-sample
|
=====> python-sample
|
||||||
not deployed
|
not deployed
|
||||||
=====> ruby-sample
|
=====> ruby-sample
|
||||||
App dir: /home/dokku/ruby-sample
|
App dir: /home/dokku/ruby-sample
|
||||||
Git sha: a2d477c
|
Git sha: a2d477c
|
||||||
|
Deploy method: git
|
||||||
```
|
```
|
||||||
|
|
||||||
You can run the command for a specific app also.
|
You can run the command for a specific app also.
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ curl "http://httpstat.us/200"
|
|||||||
|
|
||||||
### `dependencies`
|
### `dependencies`
|
||||||
|
|
||||||
- Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`.
|
- Description: Used to install system-level dependencies.
|
||||||
- Invoked by: `dokku plugin:install-dependencies`
|
- Invoked by: `dokku plugin:install-dependencies`
|
||||||
- Arguments: None
|
- Arguments: None
|
||||||
- Example:
|
- Example:
|
||||||
@@ -147,6 +147,33 @@ case "$DOKKU_DISTRO" in
|
|||||||
esac
|
esac
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `deploy-method`
|
||||||
|
|
||||||
|
- Description: Used for reporting what the current detected deployment method is. The first detected method should always win.
|
||||||
|
- Invoked by: `dokku apps:report`
|
||||||
|
- Arguments: `$APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Checks if the app should be deployed via git
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
APP="$1"
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
### `deployed-app-image-repo`
|
### `deployed-app-image-repo`
|
||||||
|
|
||||||
- Description: Used to manage the full repo of the image being deployed. Useful for deploying from an external registry where the repository name is not `dokku/$APP`
|
- Description: Used to manage the full repo of the image being deployed. Useful for deploying from an external registry where the repository name is not `dokku/$APP`
|
||||||
@@ -1155,7 +1182,7 @@ sshcommand acl-add dokku NAME < $PATH_TO_SSH_KEY
|
|||||||
Note that the `NAME` value is set at the first ssh key match. If an ssh key is set in the `/home/dokku/.ssh/authorized_keys` multiple times, the first match will decide the value.
|
Note that the `NAME` value is set at the first ssh key match. If an ssh key is set in the `/home/dokku/.ssh/authorized_keys` multiple times, the first match will decide the value.
|
||||||
|
|
||||||
- Description: Allows you to deny access to a Dokku command by either ssh user or associated ssh-command NAME user.
|
- Description: Allows you to deny access to a Dokku command by either ssh user or associated ssh-command NAME user.
|
||||||
- Invoked by `dokku`
|
- Invoked by: `dokku`
|
||||||
- Arguments: `$SSH_USER $SSH_NAME $DOKKU_COMMAND`
|
- Arguments: `$SSH_USER $SSH_NAME $DOKKU_COMMAND`
|
||||||
- Example:
|
- Example:
|
||||||
|
|
||||||
|
|||||||
@@ -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")" "$@"
|
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
@@ -15,6 +15,7 @@ report_single_app() {
|
|||||||
local flag_map=(
|
local flag_map=(
|
||||||
"--app-dir: $APP_DIR"
|
"--app-dir: $APP_DIR"
|
||||||
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)"
|
"--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
|
if [[ -z "$INFO_FLAG" ]]; then
|
||||||
|
|||||||
Executable
+21
@@ -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 "$@"
|
||||||
Executable
+21
@@ -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