refactor: extract release_and_deploy calls to a plugin trigger
Better would be to separate the release and deploy aspects into distinct triggers - as well as have it release a specific image - but this is a good first pass.
This commit is contained in:
committed by
Jose Diaz-Gonzalez
parent
1b4559c4a4
commit
696df45306
@@ -1654,6 +1654,22 @@ fi
|
|||||||
plugn trigger receive-app $APP $newrev
|
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`
|
### `report`
|
||||||
|
|
||||||
- Description: Allows you to report on any custom configuration in use by your application
|
- Description: Allows you to report on any custom configuration in use by your application
|
||||||
|
|||||||
1
plugins/20_events/release-and-deploy
Symbolic link
1
plugins/20_events/release-and-deploy
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
@@ -634,7 +634,7 @@ dokku_receive() {
|
|||||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
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_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE"
|
||||||
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||||
release_and_deploy "$APP"
|
plugn trigger release-and-deploy "$APP"
|
||||||
}
|
}
|
||||||
|
|
||||||
docker_cleanup() {
|
docker_cleanup() {
|
||||||
|
|||||||
6
plugins/common/release-and-deploy
Executable file
6
plugins/common/release-and-deploy
Executable file
@@ -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 "$@"
|
||||||
@@ -158,7 +158,7 @@ ps_start() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$RUNNING" != "true" ]]; then
|
if [[ "$RUNNING" != "true" ]]; then
|
||||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
plugn trigger release-and-deploy "$APP" "$IMAGE_TAG"
|
||||||
else
|
else
|
||||||
dokku_log_warn "App $APP already running"
|
dokku_log_warn "App $APP already running"
|
||||||
fi
|
fi
|
||||||
@@ -196,7 +196,7 @@ ps_restart() {
|
|||||||
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
||||||
|
|
||||||
if (is_deployed "$APP"); then
|
if (is_deployed "$APP"); then
|
||||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
plugn trigger release-and-deploy "$APP" "$IMAGE_TAG"
|
||||||
else
|
else
|
||||||
dokku_log_warn "App $APP has not been deployed"
|
dokku_log_warn "App $APP has not been deployed"
|
||||||
fi
|
fi
|
||||||
@@ -235,7 +235,7 @@ ps_scale() {
|
|||||||
else
|
else
|
||||||
if [[ "$(fn-ps-can-scale "$APP")" == "true" ]]; then
|
if [[ "$(fn-ps-can-scale "$APP")" == "true" ]]; then
|
||||||
set_scale "$APP" "$@"
|
set_scale "$APP" "$@"
|
||||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
plugn trigger release-and-deploy "$APP" "$IMAGE_TAG"
|
||||||
else
|
else
|
||||||
dokku_log_fail "App contains DOKKU_SCALE file and cannot be manually scaled"
|
dokku_log_fail "App contains DOKKU_SCALE file and cannot be manually scaled"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ cmd-tags-deploy() {
|
|||||||
|
|
||||||
local IMAGE="$(get_app_image_name "$APP" "$IMAGE_TAG")"
|
local IMAGE="$(get_app_image_name "$APP" "$IMAGE_TAG")"
|
||||||
verify_image "$IMAGE" || return 1
|
verify_image "$IMAGE" || return 1
|
||||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
plugn trigger release-and-deploy "$APP" "$IMAGE_TAG"
|
||||||
|
|
||||||
if [[ "$IMAGE_TAG" != "latest" ]]; then
|
if [[ "$IMAGE_TAG" != "latest" ]]; then
|
||||||
local DOKKU_SCHEDULER="$(get_app_scheduler "$APP")"
|
local DOKKU_SCHEDULER="$(get_app_scheduler "$APP")"
|
||||||
|
|||||||
Reference in New Issue
Block a user