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 committed 2021-08-05 04:17:21 -04:00
1 parent d727dd76ce
commit 30a15aaa7a
7 files changed
+7 -13

No files matched your search

@@ -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 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 `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 ### Deprecations
+1 -5
View File
@@ -47,11 +47,7 @@ func TriggerPostDeploy(appName string, imageTag string) error {
// TriggerPreDeploy is a trigger to execute predeploy and release deployment tasks // TriggerPreDeploy is a trigger to execute predeploy and release deployment tasks
func TriggerPreDeploy(appName string, imageTag string) error { func TriggerPreDeploy(appName string, imageTag string) error {
image, err := common.GetDeployingAppImageName(appName, imageTag, "") image := common.GetAppImageName(appName, imageTag, "")
if err != nil {
return err
}
if err := refreshAppJSON(appName, image); err != nil { if err := refreshAppJSON(appName, image); err != nil {
return err return err
} }
+2 -1
View File
@@ -665,7 +665,7 @@ release_and_deploy() {
source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1" local APP="$1"
local IMAGE_TAG="$2" local IMAGE_TAG="${2:-latest}"
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local DOKKU_DOCKERFILE_PORTS local DOKKU_DOCKERFILE_PORTS
@@ -687,6 +687,7 @@ release_and_deploy() {
local DOKKU_SKIP_DEPLOY=${DOKKU_APP_SKIP_DEPLOY:="$DOKKU_GLOBAL_SKIP_DEPLOY"} local DOKKU_SKIP_DEPLOY=${DOKKU_APP_SKIP_DEPLOY:="$DOKKU_GLOBAL_SKIP_DEPLOY"}
dokku_log_info1 "Releasing $APP..." dokku_log_info1 "Releasing $APP..."
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
dokku_release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" dokku_release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
if [[ "$DOKKU_SKIP_DEPLOY" != "true" ]]; then if [[ "$DOKKU_SKIP_DEPLOY" != "true" ]]; then
+1 -1
View File
@@ -10,7 +10,7 @@ trigger-config-docker-args() {
declare APP="$1" IMAGE_TAG="$2" declare APP="$1" IMAGE_TAG="$2"
local ENV_ARGS IMAGE STDIN trigger 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) STDIN=$(cat)
trigger="$0 config_docker_args" trigger="$0 config_docker_args"
+1 -4
View File
@@ -224,10 +224,7 @@ func TriggerPostStop(appName string) error {
// TriggerPreDeploy ensures an app has an up to date scale parameters // TriggerPreDeploy ensures an app has an up to date scale parameters
func TriggerPreDeploy(appName string, imageTag string) error { func TriggerPreDeploy(appName string, imageTag string) error {
image, err := common.GetDeployingAppImageName(appName, imageTag, "") image := common.GetAppImageName(appName, imageTag, "")
if err != nil {
return err
}
if err := removeProcfile(appName); err != nil { if err := removeProcfile(appName); err != nil {
return err return err
+1 -1
View File
@@ -65,7 +65,7 @@ scheduler-docker-local-pre-deploy-chown-app() {
scheduler-docker-local-pre-deploy-precheck() { scheduler-docker-local-pre-deploy-precheck() {
declare desc="Outputs the checks messages if necessary" declare desc="Outputs the checks messages if necessary"
declare APP="$1" IMAGE_TAG="$2" 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") local CHECKS_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$CHECKS_FILE' >/dev/null" RETURN INT TERM EXIT trap "rm -rf '$CHECKS_FILE' >/dev/null" RETURN INT TERM EXIT
copy_from_image "$IMAGE" "CHECKS" "$CHECKS_FILE" 2>/dev/null || true copy_from_image "$IMAGE" "CHECKS" "$CHECKS_FILE" 2>/dev/null || true
@@ -22,7 +22,6 @@ trigger-scheduler-docker-local-scheduler-deploy() {
DOKKU_HEROKUISH=false DOKKU_HEROKUISH=false
DOKKU_CNB=false DOKKU_CNB=false
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") 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_cnb_based "$IMAGE" && DOKKU_CNB=true
is_image_herokuish_based "$IMAGE" "$APP" && DOKKU_HEROKUISH=true is_image_herokuish_based "$IMAGE" "$APP" && DOKKU_HEROKUISH=true