diff --git a/plugins/00_dokku-standard/subcommands/deploy b/plugins/00_dokku-standard/subcommands/deploy index ae7ed612cd2..0d6baa52bb5 100755 --- a/plugins/00_dokku-standard/subcommands/deploy +++ b/plugins/00_dokku-standard/subcommands/deploy @@ -9,7 +9,7 @@ dokku_deploy_cmd() { declare desc="deploy phase" local cmd="deploy" [[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy" - local APP="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") + local APP="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") verify_app_name "$APP" plugn trigger pre-deploy "$APP" "$IMAGE_TAG" diff --git a/plugins/20_events/deployed-app-image-tag b/plugins/20_events/deployed-app-image-tag new file mode 100755 index 00000000000..e69de29bb2d diff --git a/plugins/20_events/deployed-app-repository b/plugins/20_events/deployed-app-repository new file mode 100755 index 00000000000..e69de29bb2d diff --git a/plugins/common/functions b/plugins/common/functions index b1ebcee7913..50a8c1ae13b 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -167,6 +167,25 @@ get_app_image_repo() { echo "$IMAGE_REPO" } +get_deploying_app_image_name() { + declare desc="return deployed image identifier for a given app, tag tuple. validate if tag is presented" + local APP="$1"; local IMAGE_TAG="$2"; + [[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null" + + local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP") + local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP") + + if [[ -n "$NEW_IMAGE_TAG" ]]; then + IMAGE_TAG="$NEW_IMAGE_TAG" + fi + + local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") + if [[ -n "$IMAGE_REMOTE_REPOSITORY" ]]; then + IMAGE="${IMAGE_REMOTE_REPOSITORY}${IMAGE}" + fi + echo "$IMAGE" +} + get_app_image_name() { declare desc="return image identifier for a given app, tag tuple. validate if tag is presented" local APP="$1"; local IMAGE_TAG="$2"; local IMAGE_REPO=$(get_app_image_repo "$APP")