chore: remove deprecated tar plugin

This plugin was deprecated in 0.24.0 in favor of git:from-archive. Users should migrate to the new command.
This commit is contained in:
Jose Diaz-Gonzalez
2021-10-09 18:43:53 -04:00
parent aa77638ca7
commit d1a16717b3
18 changed files with 9 additions and 306 deletions

View File

@@ -1036,7 +1036,7 @@ merge_dedupe_list() {
}
acquire_app_deploy_lock() {
declare desc="acquire advisory lock for use in git/tar deploys"
declare desc="acquire advisory lock for use in deploys"
local APP="$1"
local LOCK_TYPE="${2:-waiting}"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
@@ -1047,7 +1047,7 @@ acquire_app_deploy_lock() {
}
release_app_deploy_lock() {
declare desc="release advisory lock used in git/tar deploys"
declare desc="release advisory lock used in deploys"
local APP="$1"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
[[ " help tar:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/tar/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | tar:help)
cmd-tar-help "$@"
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
trigger-tar-deploy-source() {
declare desc="tar deploy-source plugin trigger"
declare trigger="deploy-source"
declare APP="$1"
local STDIN
STDIN=$(cat)
# bail if another source is detected
if [[ -n "$STDIN" ]]; then
echo "$STDIN"
return
fi
if [[ -f "$DOKKU_ROOT/$APP/src.tar" ]]; then
echo "tar"
fi
}
trigger-tar-deploy-source "$@"

View File

@@ -1,90 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
tar_build() {
declare desc="builds apps from tarball via command line"
local APP="$1"
shift 1
# clean up after ourselves
local TAR_BUILD_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$TAR_BUILD_TMP_WORK_DIR' >/dev/null" RETURN INT TERM EXIT
# extract tar file
chmod 755 "$TAR_BUILD_TMP_WORK_DIR"
pushd "$TAR_BUILD_TMP_WORK_DIR" >/dev/null
# Detect a common prefix that all files in the tar have, and strip off each directory found in it
local COMMON_PREFIX=$(tar -tf "$DOKKU_ROOT/$APP/src.tar" | sed -e 'N;s/^\(.*\).*\n\1.*$/\1\n\1/;D')
local BOGUS_PARTS=$(echo "$COMMON_PREFIX " | awk 'BEGIN{FS="/"} {print NF-1}')
dokku_log_info1_quiet "Striping $BOGUS_PARTS worth of directories from tarball"
tar -x -C "$TAR_BUILD_TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components="$BOGUS_PARTS"
chmod -R u+r "$TAR_BUILD_TMP_WORK_DIR"
local DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL DOKKU_DISABLE_ANSI_PREFIX_REMOVAL
DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL=$(config_get "$APP" DOKKU_DISABLE_ANSI_PREFIX_REMOVAL || true)
DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL=$(config_get --global DOKKU_DISABLE_ANSI_PREFIX_REMOVAL || true)
DOKKU_DISABLE_ANSI_PREFIX_REMOVAL=${DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL:="$DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL"}
if [[ "$DOKKU_DISABLE_ANSI_PREFIX_REMOVAL" == "true" ]]; then
tar_trigger_build "$APP" "$TAR_BUILD_TMP_WORK_DIR"
else
tar_trigger_build "$APP" "$TAR_BUILD_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
fi
}
tar_trigger_build() {
declare desc="triggers the actual build process for a given app within a directory at a particular revision"
declare APP="$1" TMP_WORK_DIR="$2" REV="$3"
local BUILDER
plugn trigger core-post-extract "$APP" "$TMP_WORK_DIR" "$REV"
plugn trigger post-extract "$APP" "$TMP_WORK_DIR" "$REV"
BUILDER="$(plugn trigger builder-detect "$APP" "$TMP_WORK_DIR" | head -n1 || true)"
[[ -z "$BUILDER" ]] && BUILDER="herokuish"
plugn trigger pre-receive-app "$APP" "$BUILDER" "$TMP_WORK_DIR" "$REV"
dokku_receive "$APP" "$BUILDER" "$TMP_WORK_DIR"
}
cmd-tar-in() {
declare desc="deploys app from tarball on STDIN via command line"
declare cmd="tar:in"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
tee "$DOKKU_ROOT/$APP/src.tar" | wc -c
tar_receive_app "$APP"
}
cmd-tar-from() {
declare desc="deploys app from tarball at URL via command line"
declare cmd="tar:from"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" URL="$2"
verify_app_name "$APP"
shift 2
curl -# --insecure -L "$URL" | cmd-tar-in "tar:in" "$APP" "$@"
}
tar_receive_app() {
declare desc="tar receive-app plugin trigger"
declare APP="$1"
# Don't trigger tar build if there is no tarball.
if [[ ! -f "$DOKKU_ROOT/$APP/src.tar" ]]; then
true
else
acquire_app_deploy_lock "$APP"
tar_build "$@"
release_app_deploy_lock "$APP"
fi
}

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-tar-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="tar"
local plugin_description="Manage app deploys via tar"
if [[ "$CMD" == "${plugin_name}:help" ]]; then
echo -e "Usage: dokku ${plugin_name}[:COMMAND]"
echo ''
echo "$plugin_description"
echo ''
echo 'Additional commands:'
fn-help-content | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
fn-help-content
else
cat <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
tar:in <app>, Reads an tarball containing the app from stdin
tar:from <app> <url>, Loads an app tarball from url
help_content
}

View File

@@ -1,4 +0,0 @@
[plugin]
description = "dokku core tar plugin"
version = "0.25.7"
[plugin.config]

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/functions"
tar_receive_app "$@"

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/help-functions"
cmd-tar-help "tar:help"

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/functions"
cmd-tar-from "$@"

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/functions"
cmd-tar-in "$@"