diff --git a/docs/deployment/builds-management.md b/docs/deployment/builds-management.md new file mode 100644 index 000000000..cf3e779dd --- /dev/null +++ b/docs/deployment/builds-management.md @@ -0,0 +1,30 @@ +# Build Management + +> New as of 0.19.0 + +``` +builds:cancel # Cancel a running build for an app +builds:list # List all running builds +builds:output # Shows build output +builds:report [] [] # Displays a build report for one or more apps +``` + +## Usage + +### Listing running deploys + +### Viewing the status of a deploy + +### Viewing build output for a deploy + +### Canceling a running deploy + +It can be useful to kill a deploy if that deploy does not appear to be progressing, is impacting other apps through system resource utilization, or if a successful deploy will result in app errors. To do so, the `builds:cancel` command can be used: + +```shell +dokku builds:cancel node-js-app +``` + +This command will send a `QUIT` signal to the Process Group ID of the process handling the deploy, and should terminate all processes within that process tree. Finally, it will unlock the deploy so that a new deploy may be immediately invoked. + +> Warning: This may also result in invalid app state depending upon when the app deploy was killed. diff --git a/plugins/builds/commands b/plugins/builds/commands new file mode 100755 index 000000000..bbb121222 --- /dev/null +++ b/plugins/builds/commands @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +[[ " help builds:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/builds/internal-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +case "$1" in + help | builds:help) + cmd-builds-help "$@" + ;; + + *) + exit "$DOKKU_NOT_IMPLEMENTED_EXIT" + ;; + +esac diff --git a/plugins/builds/internal-functions b/plugins/builds/internal-functions new file mode 100755 index 000000000..1b56fad60 --- /dev/null +++ b/plugins/builds/internal-functions @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +fn-builds-help-content() { + declare desc="return logs plugin help content" + cat <, Cancel a running build for an app + builds:list , List all running builds + builds:output , Shows build output + builds:report [] [], Displays a build report for one or more apps +help_content +} + +cmd-builds-help() { + if [[ $1 == "builds:help" ]]; then + echo -e 'Usage: dokku builds[:COMMAND]' + echo '' + echo 'Manage running builds' + echo '' + echo 'Additional commands:' + fn-builds-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-builds-help-content + else + cat <