From d1a16717b39c4ef339f6d251e686ea103655e653 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 9 Oct 2021 18:43:53 -0400 Subject: [PATCH] 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. --- docs/appendices/0.26.0-migration-guide.md | 1 + docs/deployment/methods/tar.md | 38 ---------- docs/development/plugin-triggers.md | 8 +- docs/getting-started/upgrading.md | 10 --- docs/processes/process-management.md | 3 - docs/template.html | 1 - docs/viewdocs.json | 2 + plugins/common/functions | 4 +- plugins/tar/commands | 16 ---- plugins/tar/deploy-source | 23 ------ plugins/tar/functions | 90 ----------------------- plugins/tar/help-functions | 33 --------- plugins/tar/plugin.toml | 4 - plugins/tar/receive-app | 6 -- plugins/tar/subcommands/default | 6 -- plugins/tar/subcommands/from | 6 -- plugins/tar/subcommands/in | 6 -- tests/unit/tar.bats | 58 --------------- 18 files changed, 9 insertions(+), 306 deletions(-) delete mode 100644 docs/deployment/methods/tar.md delete mode 100755 plugins/tar/commands delete mode 100755 plugins/tar/deploy-source delete mode 100755 plugins/tar/functions delete mode 100755 plugins/tar/help-functions delete mode 100644 plugins/tar/plugin.toml delete mode 100755 plugins/tar/receive-app delete mode 100755 plugins/tar/subcommands/default delete mode 100755 plugins/tar/subcommands/from delete mode 100755 plugins/tar/subcommands/in delete mode 100644 tests/unit/tar.bats diff --git a/docs/appendices/0.26.0-migration-guide.md b/docs/appendices/0.26.0-migration-guide.md index c06a008d0..169dfcdec 100644 --- a/docs/appendices/0.26.0-migration-guide.md +++ b/docs/appendices/0.26.0-migration-guide.md @@ -3,6 +3,7 @@ ## Removals - The `tags` plugin - deprecated in [0.24.0](/docs/appendices/0.24.0-migration-guide.md) - was removed. Users are highly encouraged to switch their workflows to `git:from-image`. +- The `tar` plugin - deprecated in [0.24.0](/docs/appendices/0.24.0-migration-guide.md) - was removed. Users are highly encouraged to switch their workflows to `git:from-archive`. ## Changes diff --git a/docs/deployment/methods/tar.md b/docs/deployment/methods/tar.md deleted file mode 100644 index 0aa84df67..000000000 --- a/docs/deployment/methods/tar.md +++ /dev/null @@ -1,38 +0,0 @@ -# Tarball Deployment - -> Warning: As of 0.24.0, this functionality is deprecated in favor of the [`git:from-archive`](/docs/deployment/methods/git.md#initializing-an-app-repository-from-an-archive-file) command. It will be removed in a future release, and is considered unmaintained. Users are highly encouraged to switch their workflows to `git:from-archive`. -> -> New as of 0.4.0 - -``` -tar:from # Loads an app tarball from url -tar:in # Reads an tarball containing the app from stdin -``` - -> When triggering `dokku ps:rebuild APP` on an application deployed via the `tar` plugin, the following may occur: -> -> - Applications previously deployed via another method (`git`): The application may revert to a state before the latest custom image tag was deployed. -> - Applications that were only ever deployed via the `tar` plugin: The application will be properly rebuilt. -> -> Please use the appropriate `tar` command when redeploying an application deployed via tarball. - -## Usage - -### Deploying from a tarball - -In some cases, it may be useful to deploy an application from a tarball. For instance, if you implemented a non-Git based deployment plugin, tarring the generated artifact may be an easier route to interface with the existing Dokku infrastructure. - -You can place the tarball on an external webserver and deploy via the `tar:from` command. - -```shell -dokku tar:from node-js-app https://dokku.me/releases/node-js-app/v1 -``` - -### Deploying via stdin - -As an alternative, a deploy can be trigged from a tarball read from stdin using the `tar:in` command: - -```shell -# run from the generated artifact directory -tar c . $* | dokku tar:in node-js-app -``` diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 20492cc85..22f0e7e83 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -346,8 +346,8 @@ curl "http://httpstat.us/200" > To avoid issues with community plugins, this plugin trigger should be used _only_ for core plugins. Please avoid using this trigger in your own plugins. -- Description: Allows you to modify the contents of an app _after_ it has been extracted from git/tarball but _before_ the image source type is detected. -- Invoked by: `dokku tar:in`, `dokku tar:from` and the `receive-app` plugin trigger +- Description: Allows you to modify the contents of an app _after_ it has been extracted from git but _before_ the image source type is detected. +- Invoked by: The `receive-app` plugin trigger - Arguments: `$APP` `$TMP_WORK_DIR` `$REV` - Example: @@ -1349,8 +1349,8 @@ sudo service haproxy reload ### `post-extract` -- Description: Allows you to modify the contents of an app _after_ it has been extracted from git/tarball but _before_ the image source type is detected. -- Invoked by: `dokku tar:in`, `dokku tar:from` and the `receive-app` plugin trigger +- Description: Allows you to modify the contents of an app _after_ it has been extracted from git but _before_ the image source type is detected. +- Invoked by: The `receive-app` plugin trigger - Arguments: `$APP` `$TMP_WORK_DIR` `$REV` - Example: diff --git a/docs/getting-started/upgrading.md b/docs/getting-started/upgrading.md index 4e3e1f8d5..681e0ba62 100644 --- a/docs/getting-started/upgrading.md +++ b/docs/getting-started/upgrading.md @@ -71,16 +71,6 @@ new buildpacks that were released: dokku ps:rebuild --all ``` -> If you have any applications deployed via the `tar` commands, do not run the `ps:rebuild --all` command, -> and instead trigger `ps:rebuild` manually for each `git`-deployed application: -> -> ``` -> dokku ps:rebuild APP -> ``` -> -> Please see the [tar documentation](/docs/deployment/methods/tar.md) -> for instructions on rebuilding applications deployed by those plugins. - ## Upgrading using `dokku-update` We provide a helpful binary called `dokku-update`. This is a recommended package that: diff --git a/docs/processes/process-management.md b/docs/processes/process-management.md index 95da4a722..3499a2dfe 100644 --- a/docs/processes/process-management.md +++ b/docs/processes/process-management.md @@ -30,9 +30,6 @@ This command will gather all the running container IDs for your app and call `do ### Rebuilding apps -> Warning: This section applies only to git-based deploys, and only works deterministically for these apps. Please see the [images documentation](/docs/deployment/methods/images.md) and [tar documentation](/docs/deployment/methods/tar.md) -> in for more information concerning rebuilding those apps. - It may be useful to rebuild an app at will, such as for commands that do not rebuild an app or when skipping a rebuild after setting multiple config values. For these use cases, the `ps:rebuild` function can be used. ```shell diff --git a/docs/template.html b/docs/template.html index fa3c3f328..3d719fd00 100644 --- a/docs/template.html +++ b/docs/template.html @@ -122,7 +122,6 @@ Deployment Methods Git Deployment - Tarfile Deployment Configuration diff --git a/docs/viewdocs.json b/docs/viewdocs.json index 53e5edaa0..fa4344ca5 100644 --- a/docs/viewdocs.json +++ b/docs/viewdocs.json @@ -22,7 +22,9 @@ "deployment/methods/herokuish-buildpacks": "deployment/builders/herokuish-buildpacks/", "deployment/images": "deployment/methods/git/#initializing-an-app-repository-from-a-docker-image", + "deployment/tar": "deployment/methods/git/#initializing-an-app-repository-from-an-archive-file", "deployment/methods/images": "deployment/methods/git/#initializing-an-app-repository-from-a-docker-image", + "deployment/methods/tar": "deployment/methods/git/#initializing-an-app-repository-from-an-archive-file", "configuration-management": "configuration/environment-variables/", "deployment/ssl-configuration": "configuration/ssl/", "nginx": "configuration/nginx/", diff --git a/plugins/common/functions b/plugins/common/functions index e22d160ca..dd52d3fac 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -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" diff --git a/plugins/tar/commands b/plugins/tar/commands deleted file mode 100755 index 7ae2dcc7a..000000000 --- a/plugins/tar/commands +++ /dev/null @@ -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 diff --git a/plugins/tar/deploy-source b/plugins/tar/deploy-source deleted file mode 100755 index 449f9dc85..000000000 --- a/plugins/tar/deploy-source +++ /dev/null @@ -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 "$@" diff --git a/plugins/tar/functions b/plugins/tar/functions deleted file mode 100755 index 27fccefed..000000000 --- a/plugins/tar/functions +++ /dev/null @@ -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 -} diff --git a/plugins/tar/help-functions b/plugins/tar/help-functions deleted file mode 100755 index 8ed7191c5..000000000 --- a/plugins/tar/help-functions +++ /dev/null @@ -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 <, Reads an tarball containing the app from stdin - tar:from , Loads an app tarball from url -help_content -} diff --git a/plugins/tar/plugin.toml b/plugins/tar/plugin.toml deleted file mode 100644 index ad26f89e0..000000000 --- a/plugins/tar/plugin.toml +++ /dev/null @@ -1,4 +0,0 @@ -[plugin] -description = "dokku core tar plugin" -version = "0.25.7" -[plugin.config] diff --git a/plugins/tar/receive-app b/plugins/tar/receive-app deleted file mode 100755 index 954655cf1..000000000 --- a/plugins/tar/receive-app +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -[[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/tar/functions" - -tar_receive_app "$@" diff --git a/plugins/tar/subcommands/default b/plugins/tar/subcommands/default deleted file mode 100755 index 49769bdea..000000000 --- a/plugins/tar/subcommands/default +++ /dev/null @@ -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" diff --git a/plugins/tar/subcommands/from b/plugins/tar/subcommands/from deleted file mode 100755 index fb3011cd6..000000000 --- a/plugins/tar/subcommands/from +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -[[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/tar/functions" - -cmd-tar-from "$@" diff --git a/plugins/tar/subcommands/in b/plugins/tar/subcommands/in deleted file mode 100755 index 58bb58977..000000000 --- a/plugins/tar/subcommands/in +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -[[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/tar/functions" - -cmd-tar-in "$@" diff --git a/tests/unit/tar.bats b/tests/unit/tar.bats deleted file mode 100644 index 7d0e3247c..000000000 --- a/tests/unit/tar.bats +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bats - -load test_helper - -setup() { - global_setup - create_app -} - -teardown() { - destroy_app - global_teardown -} - -deploy_app_tar() { - APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"} - TMP=$(mktemp -d "/tmp/dokku.me.XXXXX") - - rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/$APP_TYPE" "$TMP" - pushd "$TMP" &>/dev/null || exit 1 - trap 'popd &>/dev/null || true; rm -rf "$TMP"' RETURN INT TERM - - shift 1 - tar c . $* | ssh dokku@dokku.me tar:in $TEST_APP || destroy_app $? - sleep 5 # nginx needs some time to itself... -} - -@test "(tar) tar:help" { - run /bin/bash -c "dokku tar" - echo "output: $output" - echo "status: $status" - assert_output_contains "Manage app deploys via tar" - help_output="$output" - - run /bin/bash -c "dokku tar:help" - echo "output: $output" - echo "status: $status" - assert_output_contains "Manage app deploys via tar" - assert_output "$help_output" -} - -@test "(tar) non-tarbomb deploy using tar:in" { - deploy_app_tar nodejs-express --transform 's,^,prefix/,' - - run /bin/bash -c "response=\"$(curl -s -S ${TEST_APP}.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\"" - echo "output: $output" - echo "status: $status" - assert_success -} - -@test "(tar) tarbomb deploy using tar:in" { - deploy_app_tar nodejs-express - - run /bin/bash -c "response=\"$(curl -s -S ${TEST_APP}.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\"" - echo "output: $output" - echo "status: $status" - assert_success -}