feat: allow specifying a single process type to restart

This changes restarts to drop the 'release' part that currently gets triggered, which also helps reduce the possibility that a new image layer will be added due to predeploy deploy triggers.

Note that the old method essentially halfway-rebuilt the app (which was what added the extra layer). This refactor removes that, which is a bc-break.

Additionally, scaling processes will result in deploying _only_ restarting the processes being scaled.

Closes #2184
This commit is contained in:
Jose Diaz-Gonzalez
2021-09-05 00:02:46 -04:00
parent 8f7f03a7d8
commit b48b79f5ca
13 changed files with 115 additions and 36 deletions

View File

@@ -286,16 +286,14 @@ get_deploying_app_image_name() {
declare desc="return deploying image identifier for a given app, tag tuple. validate if tag is presented"
local APP="$1"
local IMAGE_TAG="$2"
IMAGE_REPO="$3"
local IMAGE_REPO="$3"
IMAGE_TAG="$(get_running_image_tag "$APP" "$IMAGE_TAG")"
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
local NEW_IMAGE_REPO=$(plugn trigger deployed-app-image-repo "$APP")
[[ -n "$NEW_IMAGE_REPO" ]] && IMAGE_REPO="$NEW_IMAGE_REPO"
[[ -n "$NEW_IMAGE_TAG" ]] && IMAGE_TAG="$NEW_IMAGE_TAG"
[[ -z "$IMAGE_REPO" ]] && IMAGE_REPO=$(get_app_image_repo "$APP")
[[ -z "$IMAGE_TAG" ]] && IMAGE_TAG="latest"
local IMAGE="${IMAGE_REMOTE_REPOSITORY}${IMAGE_REPO}:${IMAGE_TAG}"
verify_image "$IMAGE" || dokku_log_fail "App image ($IMAGE) not found"
@@ -329,12 +327,14 @@ get_app_scheduler() {
}
get_running_image_tag() {
declare desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found"
local APP="$1"
declare desc="retrieves current deployed image tag for a given app"
local APP="$1" IMAGE_TAG="$2"
local CIDS=($(get_app_container_ids "$APP"))
local RUNNING_IMAGE_TAG=$("$DOCKER_BIN" container inspect --format '{{ .Config.Image }}' "${CIDS[0]}" 2>/dev/null | awk -F: '{ print $2 }' || echo '')
echo "$RUNNING_IMAGE_TAG"
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
[[ -n "$NEW_IMAGE_TAG" ]] && IMAGE_TAG="$NEW_IMAGE_TAG"
[[ -z "$IMAGE_TAG" ]] && IMAGE_TAG="latest"
echo "$IMAGE_TAG"
}
is_image_cnb_based() {
@@ -638,12 +638,11 @@ dokku_release() {
cmd-deploy() {
declare desc="deploy phase"
declare APP="$1" IMAGE_TAG="$2"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
declare APP="$1" IMAGE_TAG="$2" PROCESS_TYPE="$3"
verify_app_name "$APP"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-deploy "$DOKKU_SCHEDULER" "$APP" "$IMAGE_TAG"
plugn trigger scheduler-deploy "$DOKKU_SCHEDULER" "$APP" "$IMAGE_TAG" "$PROCESS_TYPE"
}
release_and_deploy() {