Allow specifying the deploy branch via DOKKU_DEPLOY_BRANCH

Closes #2494
This commit is contained in:
Jose Diaz-Gonzalez
2017-01-26 00:32:23 -07:00
parent f24e777921
commit 0aeee7ea28
4 changed files with 57 additions and 7 deletions

View File

@@ -145,3 +145,17 @@ teardown() {
echo "status: "$status
assert_success
}
@test "(config) deploy specific DOKKU_DEPLOY_BRANCH" {
run ssh dokku@dokku.me config:set --global DOKKU_DEPLOY_BRANCH=global-branch
GIT_REMOTE_BRANCH=global-branch deploy_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
}

View File

@@ -196,10 +196,11 @@ assert_http_redirect() {
}
deploy_app() {
local APP_TYPE="$1"; local APP_TYPE=${APP_TYPE:="nodejs-express"}
local GIT_REMOTE="$2"; local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
local CUSTOM_TEMPLATE="$3"; local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
local CUSTOM_PATH="$4"
declare APP_TYPE="$1" GIT_REMOTE="$2" CUSTOM_TEMPLATE="$3" CUSTOM_PATH="$4"
local APP_TYPE=${APP_TYPE:="nodejs-express"}
local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"}
local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
rmdir "$TMP" && cp -r "./tests/apps/$APP_TYPE" "$TMP"
@@ -218,7 +219,7 @@ deploy_app() {
[[ -f gitignore ]] && mv gitignore .gitignore
git add .
git commit -m 'initial commit'
git push target master || destroy_app $?
git push target "master:${GIT_REMOTE_BRANCH}" || destroy_app $?
}
setup_client_repo() {