fix: respect pre-deploy task image manipulation

This requires a bc-incompatible break in terms of what triggers the pre-deploy hook (dokku internals vs schedulers).
This commit is contained in:
Jose Diaz-Gonzalez
2021-08-05 04:16:49 -04:00
parent d727dd76ce
commit 30a15aaa7a
7 changed files with 7 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ The [dokku-registry](https://github.com/dokku/dokku-registry) plugin is now buil
- The network plugin can now set an `initial-network` for all containers on creation. This is a replacement for specifying the `--network` flag via the `docker-options` plugin. Please see the [network documentation](/docs/networking/network.md#attaching-an-app-to-a-network) for more information.
- The `dokku run` command now always removes the ephemeral container on exit. Users that need a persistent container should instead specify a `console` process type in their `Procfile` specifying an available shell (usually either `bash` or `sh`) and scale that container appropriately.
- The `pre-deploy` plugin trigger is now called internally by Dokku. Scheduler plugins should avoid calling this trigger, as any image changes introduced by subsequent trigger calls will be ignored.
### Deprecations

View File

@@ -47,11 +47,7 @@ func TriggerPostDeploy(appName string, imageTag string) error {
// TriggerPreDeploy is a trigger to execute predeploy and release deployment tasks
func TriggerPreDeploy(appName string, imageTag string) error {
image, err := common.GetDeployingAppImageName(appName, imageTag, "")
if err != nil {
return err
}
image := common.GetAppImageName(appName, imageTag, "")
if err := refreshAppJSON(appName, image); err != nil {
return err
}

View File

@@ -665,7 +665,7 @@ release_and_deploy() {
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1"
local IMAGE_TAG="$2"
local IMAGE_TAG="${2:-latest}"
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local DOKKU_DOCKERFILE_PORTS
@@ -687,6 +687,7 @@ release_and_deploy() {
local DOKKU_SKIP_DEPLOY=${DOKKU_APP_SKIP_DEPLOY:="$DOKKU_GLOBAL_SKIP_DEPLOY"}
dokku_log_info1 "Releasing $APP..."
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
dokku_release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
if [[ "$DOKKU_SKIP_DEPLOY" != "true" ]]; then

View File

@@ -10,7 +10,7 @@ trigger-config-docker-args() {
declare APP="$1" IMAGE_TAG="$2"
local ENV_ARGS IMAGE STDIN trigger
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
STDIN=$(cat)
trigger="$0 config_docker_args"

View File

@@ -224,10 +224,7 @@ func TriggerPostStop(appName string) error {
// TriggerPreDeploy ensures an app has an up to date scale parameters
func TriggerPreDeploy(appName string, imageTag string) error {
image, err := common.GetDeployingAppImageName(appName, imageTag, "")
if err != nil {
return err
}
image := common.GetAppImageName(appName, imageTag, "")
if err := removeProcfile(appName); err != nil {
return err

View File

@@ -65,7 +65,7 @@ scheduler-docker-local-pre-deploy-chown-app() {
scheduler-docker-local-pre-deploy-precheck() {
declare desc="Outputs the checks messages if necessary"
declare APP="$1" IMAGE_TAG="$2"
local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local CHECKS_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$CHECKS_FILE' >/dev/null" RETURN INT TERM EXIT
copy_from_image "$IMAGE" "CHECKS" "$CHECKS_FILE" 2>/dev/null || true

View File

@@ -22,7 +22,6 @@ trigger-scheduler-docker-local-scheduler-deploy() {
DOKKU_HEROKUISH=false
DOKKU_CNB=false
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
is_image_cnb_based "$IMAGE" && DOKKU_CNB=true
is_image_herokuish_based "$IMAGE" "$APP" && DOKKU_HEROKUISH=true