fix: do not trigger git builds when calling tar:from

Closes #3047
This commit is contained in:
Jose Diaz-Gonzalez
2018-03-03 18:30:17 -05:00
parent c9d9750afe
commit 2b0d34d0db
4 changed files with 32 additions and 36 deletions

View File

@@ -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"

View File

@@ -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 "$@"

View File

@@ -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
}

View File

@@ -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 "$@"