diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 2a9f42e67..92c356654 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -1654,6 +1654,22 @@ fi plugn trigger receive-app $APP $newrev ``` +### `release-and-deploy` + +- Description: Triggers a release of the image tag and a subsequent deploy +- Invoked by: +- Arguments: `$APP $IMAGE_TAG` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +APP="$1"; + +# TODO +``` + ### `report` - Description: Allows you to report on any custom configuration in use by your application diff --git a/plugins/20_events/release-and-deploy b/plugins/20_events/release-and-deploy new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/release-and-deploy @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/common/functions b/plugins/common/functions index 8f882de11..08908cd6f 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -634,7 +634,7 @@ dokku_receive() { dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..." DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR" - release_and_deploy "$APP" + plugn trigger release-and-deploy "$APP" } docker_cleanup() { diff --git a/plugins/common/release-and-deploy b/plugins/common/release-and-deploy new file mode 100755 index 000000000..26610e28e --- /dev/null +++ b/plugins/common/release-and-deploy @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +release_and_deploy "$@" diff --git a/plugins/ps/functions b/plugins/ps/functions index e1dda2a68..bec1dbfbb 100755 --- a/plugins/ps/functions +++ b/plugins/ps/functions @@ -158,7 +158,7 @@ ps_start() { fi if [[ "$RUNNING" != "true" ]]; then - release_and_deploy "$APP" "$IMAGE_TAG" + plugn trigger release-and-deploy "$APP" "$IMAGE_TAG" else dokku_log_warn "App $APP already running" fi @@ -196,7 +196,7 @@ ps_restart() { local IMAGE_TAG=$(get_running_image_tag "$APP") if (is_deployed "$APP"); then - release_and_deploy "$APP" "$IMAGE_TAG" + plugn trigger release-and-deploy "$APP" "$IMAGE_TAG" else dokku_log_warn "App $APP has not been deployed" fi @@ -235,7 +235,7 @@ ps_scale() { else if [[ "$(fn-ps-can-scale "$APP")" == "true" ]]; then set_scale "$APP" "$@" - release_and_deploy "$APP" "$IMAGE_TAG" + plugn trigger release-and-deploy "$APP" "$IMAGE_TAG" else dokku_log_fail "App contains DOKKU_SCALE file and cannot be manually scaled" fi diff --git a/plugins/tags/subcommands/deploy b/plugins/tags/subcommands/deploy index 227b0f30a..e78e86202 100755 --- a/plugins/tags/subcommands/deploy +++ b/plugins/tags/subcommands/deploy @@ -14,7 +14,7 @@ cmd-tags-deploy() { local IMAGE="$(get_app_image_name "$APP" "$IMAGE_TAG")" verify_image "$IMAGE" || return 1 - release_and_deploy "$APP" "$IMAGE_TAG" + plugn trigger release-and-deploy "$APP" "$IMAGE_TAG" if [[ "$IMAGE_TAG" != "latest" ]]; then local DOKKU_SCHEDULER="$(get_app_scheduler "$APP")"