From 2b0d34d0db5ddbac3ab9485e3af77c64ec597031 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Mar 2018 18:30:17 -0500 Subject: [PATCH] fix: do not trigger git builds when calling tar:from Closes #3047 --- plugins/git/functions | 17 ++++++++++++++++- plugins/git/receive-app | 17 ----------------- plugins/tar/functions | 17 ++++++++++++++++- plugins/tar/receive-app | 17 ----------------- 4 files changed, 32 insertions(+), 36 deletions(-) diff --git a/plugins/git/functions b/plugins/git/functions index c98efab1b..b7dc22b2f 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -141,7 +141,7 @@ git_hook_cmd() { if [[ $refname = "refs/heads/${DOKKU_DEPLOY_BRANCH}" ]]; then # broken out into plugin so we might support other methods to receive an app # shellcheck disable=SC2086 - plugn trigger receive-app $APP $newrev + git_receive_app "$APP" "$newrev" else if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then # shellcheck disable=SC2086 @@ -169,6 +169,21 @@ git_build() { git_build_app_repo $APP $REF } +git_receive_app() { + declare desc="git receive-app plugin trigger" + declare APP="$1" REV="$2" + + # Don't trigger git build if there is no git repository. + if [[ ! -d "$DOKKU_ROOT/$APP/refs" ]]; then + true + else + acquire_app_deploy_lock "$APP" "exclusive" + # shellcheck disable=SC2086 + git_build $APP $REV + release_app_deploy_lock "$APP" + fi +} + git_upload_pack_cmd() { declare desc="executes git-upload-pack" declare cmd="git-upload-pack" diff --git a/plugins/git/receive-app b/plugins/git/receive-app index 652bc15b2..dc00a4c11 100755 --- a/plugins/git/receive-app +++ b/plugins/git/receive-app @@ -1,22 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/git/functions" -git_receive_app() { - declare desc="git receive-app plugin trigger" - local trigger="git_receive_app" - local APP="$1"; local REV="$2" - - # Don't trigger git build if there is no git repository. - if [[ ! -d "$DOKKU_ROOT/$APP/refs" ]]; then - true - else - acquire_app_deploy_lock "$APP" "exclusive" - # shellcheck disable=SC2086 - git_build $APP $REV - release_app_deploy_lock "$APP" - fi -} - git_receive_app "$@" diff --git a/plugins/tar/functions b/plugins/tar/functions index 2219874b6..6c4ee5b00 100755 --- a/plugins/tar/functions +++ b/plugins/tar/functions @@ -57,7 +57,7 @@ tar_in_cmd() { verify_app_name "$2" tee "$DOKKU_ROOT/$APP/src.tar" | wc -c - plugn trigger receive-app "$APP" + tar_receive_app "$APP" } tar_from_cmd() { @@ -69,3 +69,18 @@ tar_from_cmd() { shift 3 curl -# --insecure -L "$URL" | tar_in_cmd "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" + # shellcheck disable=SC2086 + tar_build "$@" + release_app_deploy_lock "$APP" + fi +} diff --git a/plugins/tar/receive-app b/plugins/tar/receive-app index 4ff75f293..9c249be45 100755 --- a/plugins/tar/receive-app +++ b/plugins/tar/receive-app @@ -1,22 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/tar/functions" -tar_receive_app() { - declare desc="tar receive-app plugin trigger" - local trigger="tar_receive_app" - local APP="$1"; local REV="$2" - - # 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" - # shellcheck disable=SC2086 - tar_build "$@" - release_app_deploy_lock "$APP" - fi -} - tar_receive_app "$@"