From 19806636ad3da9f24d9f0d6f60cbf59e476e98ad Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 12 Jan 2018 13:38:28 -0500 Subject: [PATCH 1/2] fix: ensure we respect DOKKU_DEPLOY_BRANCH when rebuilding applications Closes #3021 --- plugins/git/functions | 3 ++- tests/unit/20_config.bats | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index e3ee2c5fa..b229530a1 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -145,7 +145,8 @@ git_build() { if [[ $# -ge 2 ]]; then local REF="$2" else - local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master") + DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")" + local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH") fi # shellcheck disable=SC2086 diff --git a/tests/unit/20_config.bats b/tests/unit/20_config.bats index 87dafa332..511b72e7c 100644 --- a/tests/unit/20_config.bats +++ b/tests/unit/20_config.bats @@ -153,9 +153,19 @@ teardown() { echo "status: "$status assert_success + run ssh dokku@dokku.me ps:rebuild $TEST_APP + echo "output: "$output + echo "status: "$status + assert_success + run ssh dokku@dokku.me config:set $TEST_APP DOKKU_DEPLOY_BRANCH=app-branch GIT_REMOTE_BRANCH=app-branch deploy_app echo "output: "$output echo "status: "$status assert_success + + run ssh dokku@dokku.me ps:rebuild $TEST_APP + echo "output: "$output + echo "status: "$status + assert_success } From 28c409509cf01d1b3e67c26b233b22b6c5845c8a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 12 Jan 2018 13:42:10 -0500 Subject: [PATCH 2/2] fix: declare DOKKU_DEPLOY_BRANCH --- plugins/git/functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index b229530a1..6ca0ccb0f 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -142,11 +142,12 @@ git_hook_cmd() { git_build() { declare desc="setup and call git_build_app_repo" local APP="$1" + local DOKKU_DEPLOY_BRANCH REF if [[ $# -ge 2 ]]; then local REF="$2" else DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")" - local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH") + REF=$(< "$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH") fi # shellcheck disable=SC2086