Merge pull request #3630 from dokku/3592-notify-on-bad-branch

Fix issue where push warning on bad branch was skipped
This commit is contained in:
Jose Diaz-Gonzalez
2019-08-02 11:20:46 -04:00
committed by GitHub
2 changed files with 11 additions and 5 deletions

View File

@@ -143,12 +143,12 @@ git_hook_cmd() {
# shellcheck disable=SC2086
git_receive_app "$APP" "$newrev"
else
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 1 ]]; then
# shellcheck disable=SC2086
plugn trigger receive-branch $APP $newrev $refname
else
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\//}:master'"
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to ${DOKKU_DEPLOY_BRANCH}."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\//}:${DOKKU_DEPLOY_BRANCH}'"
fi
fi
done

View File

@@ -18,7 +18,7 @@ teardown() {
echo "status: $status"
assert_success
GIT_REMOTE_BRANCH=global-branch deploy_app
GIT_REMOTE_BRANCH=global-branch run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
@@ -28,8 +28,14 @@ teardown() {
echo "status: $status"
assert_success
run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "deploy did not complete"
run /bin/bash -c "dokku git:set $TEST_APP deploy-branch app-branch"
GIT_REMOTE_BRANCH=app-branch deploy_app
GIT_REMOTE_BRANCH=app-branch run deploy_app
echo "output: $output"
echo "status: $status"
assert_success